Docker takes up so much disk space (solved)

  • Running OMV 4.19 on a 8GB USB drive, the partition that OMV created for itself it around 4GB during installation.
    I used to have docker+emby server installed and they have been working fine!


    Today I tried to installed jdownloader ( 2 version avail through searching), I installed one (following Techno Dad Life's video) but it failed to connect to my jdownloader acc, the 2nd one, plusminus/jdownloader2-headless, never managed to download properly in docker, I also tried to download it using command line, 2x300Mb files were extremely slow speed I decided to give up.


    so, I went back to OMV and deleted the installed jdownloader in docker... I realized that these images that docker have been downloading all have very big file size... so i checked disk space and it has 300MB left...


    what shall I do in order to free up some space?
    this USB drive has 8GB space but OMV only uses 4GB...


    Any advise will be greatly appreciated. thanks


    I ran df -h and the result is shown below.




    Filesystem Size Used Avail Use% Mounted on
    udev 940M 0 940M 0% /dev
    tmpfs 192M 8.5M 184M 5% /run
    /dev/sdb1 3.5G 3.0G 289M 92% /
    tmpfs 960M 0 960M 0% /dev/shm
    tmpfs 5.0M 0 5.0M 0% /run/lock
    tmpfs 960M 0 960M 0% /sys/fs/cgroup
    tmpfs 960M 20K 960M 1% /tmp
    /dev/sda1 458G 49G 410G 11% /srv/dev-disk-by-label-500GB
    folder2ram 960M 177M 784M 19% /var/log
    folder2ram 960M 0 960M 0% /var/tmp
    folder2ram 960M 584K 959M 1% /var/lib/openmediavault/rrd
    folder2ram 960M 16K 960M 1% /var/spool
    folder2ram 960M 13M 947M 2% /var/lib/rrdcached
    folder2ram 960M 8.0K 960M 1% /var/lib/monit
    folder2ram 960M 4.0K 960M 1% /var/lib/php
    folder2ram 960M 0 960M 0% /var/lib/netatalk/CNID
    folder2ram 960M 420K 959M 1% /var/cache/samba
    overlay 3.5G 3.0G 289M 92% /var/lib/docker/overlay2/787802b8a2138bc98090c15e4455e74d8eb35058646edc184dbc25506e046069/merged
    shm 64M 0 64M 0% /var/lib/docker/containers/ee798d4a04b35dea6099917ae7c021ec595d6b900dd043a02ed77915706d1082/mounts/shm



    /var/lib/docker/overlay2/ is big... it has DOCKER in the link... but when I look inside the folder, it has these folders in it.



    bin,config,dev, etc, home, init, lib, libexec, licenses, mnt, proc, root, share, sys, system, tmp, usr, var

  • Try moving your docker base path to a data drive.

    --
    Google is your friend and Bob's your uncle!


    OMV AMD64 7.x on headless Chenbro NR12000 1U 1x 8m Quad Core E3-1220 3.1GHz 32GB ECC RAM.

    • Offizieller Beitrag

    1. Create your container folder ("Containers") in the webUI. This will store your containers on one of your data drives (which are presumably much larger than 8gig)


    2. SSH your server and get root access


    3. Stop docker service: systemctl stop docker


    4. Move the docker folder to Containers folder: mv /var/lib/docker /sharedfolders/Containers


    5. Create a link between the two: ln -s /sharedfolders/Containers /var/lib/docker


    6. Start docker service: systemctl start docker


    Problem solved.

  • Try moving your docker base path to a data drive.


    thanks guys, yes, i have a storage HDD for data.
    I will give it a shot when I have time these 2 days...
    cheers!!!!!!!!!!!!!


  • It is far easier to use the plugin's Settings tab to relocate the docker base path.

    --
    Google is your friend and Bob's your uncle!


    OMV AMD64 7.x on headless Chenbro NR12000 1U 1x 8m Quad Core E3-1220 3.1GHz 32GB ECC RAM.

    • Offizieller Beitrag

    It is far easier to use the plugin's Settings tab to relocate the docker base path.

    It is, but not on a system that is already set up. If was at the beginning with no containers running.. I'd agree with you (but then he wouldn't be having this issue yet). On a system that is already set up however, unless you want to start over... doing it the way I suggested preserves the setup of his currently running containers. Changing the containers folder in the webUI, doesn't move the data. So he'll either have to move the data anyway via command line, or he'll have to delete /var/lib/dockers to reclaim the space on his OS drive, and start over and set up all his containers again.

  • I used the Settings tab to relocate my existing docker base path. I had no problems with any of the existing containers that were running. The only manual thing I needed to do was delete the the directorys in the old base path because in my case the plugin only copied the data to the new path. It did not delete the old path's contents for me.

    --
    Google is your friend and Bob's your uncle!


    OMV AMD64 7.x on headless Chenbro NR12000 1U 1x 8m Quad Core E3-1220 3.1GHz 32GB ECC RAM.

    • Offizieller Beitrag

    Maybe he's made changes to the plugin, I know when I initially set up docker, and had no containers folder.... when I set a containers folder webui and restarted docker, none of my running containers were there, etc. and it was essentially like I was starting over and did not copy my container data over to the new containers folder.


    Edit: You basically said exactly what I just said in this thread in post #13... https://forum.openmediavault.o…sing-space-on-boot-drive/

  • I used the Settings tab to relocate my existing docker base path. I had no problems with any of the existing containers that were running. The only manual thing I needed to do was delete the the directorys in the old base path because in my case the plugin only copied the data to the new path. It did not delete the old path's contents for me.


    Maybe he's made changes to the plugin, I know when I initially set up docker, and had no containers folder.... when I set a containers folder webui and restarted docker, none of my running containers were there, etc. and it was essentially like I was starting over and did not copy my container data over to the new containers folder.


    Edit: You basically said exactly what I just said in this thread in post #13... https://forum.openmediavault.o…sing-space-on-boot-drive/

    I ended up solving it using the dumb way... i reinstalled docker and emby. not the shared folder is located in my hdd, also I rearranged my folders so that everything looks more neat now.
    I deleted lib/docker folder on my USB drive and 950MB has been free up.


    thanks guys!

  • UPDATE
    gderf wrote:I used the Settings tab to relocate my existing docker base path. I had no problems with any of the existing containers that were running. The only manual thing I needed to do was delete the the directorys in the old base path because in my case the plugin only copied the data to the new path. It did not delete the old path's contents for me.
    [/quote]

    Maybe he's made changes to the plugin, I know when I initially set up docker, and had no containers folder.... when I set a containers folder webui and restarted docker, none of my running containers were there, etc. and it was essentially like I was starting over and did not copy my container data over to the new containers folder.


    Edit: You basically said exactly what I just said in this thread in post #13... https://forum.openmediavault.o…sing-space-on-boot-drive/


    thanks guys!

  • I tried this method, it moved my containers folder and removed 6gb of space from my thumb drive, however my docker is empty in the webgui,


    I restarted OMV4 to see if that would help, but no luck

    I then went to the docker settings and pointed it to my containers shared folder, no luck

    I restarted omv4

    i then launched WinSCP and I saw a shortcut to "dockers" (plural, not docker)

    so I ssh'ed my server and ran


    1.) systemctl stop docker


    2.) ln -s /sharedfolders/Containers /var/lib/docker


    3.) systemctl start docker


    but this had no effect either,


    I know this thread is over a year old but I could use some help, I'm hoping i don't need to rebuild all my docker images

    • Offizieller Beitrag

    The path is absolutely /var/lib/docker, not /var/lib/dockers. I've done that so many times I never knew I had a typo in that post. The docker settings (If you're doing it this way), should remain /var/lib/docker. Hopefully it didn't get overwritten when you did that. Try this.


    Make sure docker is stopped


    mv /sharedfolders/Containers/dockers /sharedfolders/Containers/docker


    That should essentially rename the directory to the correct name of "docker" (you'll have to be root to do this as well)


    Recreate the link


    Restart docker


    That should do it, otherwise you will likely have to start over.

  • Thank you for the reply, I tried that and got an error (line #3)


    Code
    root@openmediavault:~# systemctl stop docker
    root@openmediavault:~# mv /sharedfolders/Containers/dockers /sharedfolders/Containers/docker
    mv: cannot stat '/sharedfolders/Containers/dockers': No such file or directory
    root@openmediavault:~# ln -s /sharedfolders/Containers /var/lib/docker
    ln: failed to create symbolic link '/var/lib/docker/Containers': File exists
    root@openmediavault:~#


    so I checked to make sure it was moved and still named docker... and it is


  • Using a /sharedfolders path for anything to do with docker is not a good idea.

    --
    Google is your friend and Bob's your uncle!


    OMV AMD64 7.x on headless Chenbro NR12000 1U 1x 8m Quad Core E3-1220 3.1GHz 32GB ECC RAM.

  • I did a little digging using WinSCP in the folder structure


    when I go to "/Var/lib/docker" I have a shortcut for "Containers" when I open containers it changes my folder path to "/sharedfolders/Containers".


    in order to see the containers i have to dive down to:

    "/sharedfolders/Containers/docker/containers"


    I'm not sure if this is the correct folder structure or if it seems nested in a way

    • Offizieller Beitrag

    Yeah you did something wrong. Normally, you would move docker to /sharedfolders/Containers then there would be a subfolder there called docker. Create the link and start docker, and you will then see the directory structure under Containers and the docker folder will be gone

    • Offizieller Beitrag

    Using a /sharedfolders path for anything to do with docker is not a good idea.

    If you just use it as a link, it's fine. But putting in the path section in the webui, you're right. I've never used the webui to set my container path and have always used the link method described, and always linked it to /sharedfolders


    I suspect when he changed it in the webui, which he should not have done if he was going to do it this way, he overwrote his containers.

    • Offizieller Beitrag

    thank you for your reply as well, how would you recommend to handle this? I'm a noob so I don't know how to do this with out using /sharedfolders

    If you end up starting over, and use the webui to set the container path, you will need to use the absolute path of your containers folder (it will be under /srv ). Using /sharedfolders will cause problems if used directly


    Edit:. Looking again, it looks like your original docker folder is safe. I would delete all those other directories, then use the webui to point at /Containers/docker (but you will have to find the absolute path)

  • Edit:. Looking again, it looks like your original docker folder is safe. I would delete all those other directories, then use the webui to point at /Containers/docker (but you will have to find the absolute path)


    okay in the webui do I put


    1.) /srv/dev-disk-by-label-8TB1/Appdata/Containers/


    or


    2.) /srv/dev-disk-by-label-8TB1/Appdata/Containers/docker


    just want to make sure


    Edit: will i need to stop docker then make the change and then restart docker

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!