Docker increase disk space

前端 未结 4 1586
滥情空心
滥情空心 2020-12-06 05:18

I have a docker running and it gives me disk space warning. How can i increase the docker space and start again? (The same container)

Lets say I want to give like 15

4条回答
  •  Happy的楠姐
    2020-12-06 06:10

    I ran into similar problem with my docker-vm (which is 'alpine-linux' on VMware Fusion in OS X):

     write error: no space left on device alpinevm:/mnt/hgfs
     failed to build: .. no space left on device
    

    .. eventually this guide helped me to resize/expand my docker volume.

    TL;DR:

    1 - Check size of partition containing /var/lib/docker

    > df -h
    /dev/sda3                17.6G      4.1G     12.6G  25% /var/lib/docker
    

    look for '/dev/sdaN', where N is your partition for '/var/lib/docker', in my case /dev/sda3

    2 - Shut down your VM, open VM Settings > Hard Disk(s) > change size of your 'virtual_disk.vmdk' (or whatever is your machine's virtual disk), then click Apply (see this guide).

    3 - Install cfdisk and e2fsprogs-extra which contains resize2fs

    > apk add cfdisk
    > apk add e2fsprogs-extra
    

    4 - Run cfdisk and resize/expand /dev/sda3

    > cfdisk
    Device     Boot    Start       End   Sectors   Size  Id Type
    
    /dev/sda1  *        2048    206847    204800   100M  83 Linux
    /dev/sda2         206848   4241407   4034560   1.9G  82 Linux swap / Solaris
    /dev/sda3        4241408  83886079  79644672  12.6G  83 Linux
    
    [Bootable]  [ Delete ]  [ Resize ]  [  Quit  ]  [  Type  ]  [  Help  ]  [  Write ]  [  Dump  ]
    

    .. press down/up to select '/dev/sda3'

    .. press left/right/enter to select 'Resize' -> 'Write' -> 'Quit'

    5 - Run resize2fs to expand the file system of /dev/sda3

    > resize2fs /dev/sda3
    

    6 - Verify resized volume

    > df -h
    /dev/sda3                37.3G      4.1G     31.4G  12% /var/lib/docker
    

提交回复
热议问题