dockerubuntu-18.04

how to change root dir of docker on ubuntu 18.04 LTS? (docker change location of volumes)


I installed ubuntu 18.04 LTS and checked a setting for docker (17.06.2-ce) to install at the same time.

I tested by starting the hello-world (sudo docker run hello-world) :

[...] Hello from Docker! This message shows that your installation appears to be working correctly. [...]

I mounted a software raid on the folder named /raid, and make a folder /docker-data in it.

I try to change the root dir of my docker to put it in /raid/docker-data/ by following the few tutorials on the network... in vain.

these solutions don't work either :

Docker Root Dir: /var/snap/docker/common/var-lib-docker

Has anyone managed to do this feat in recent months?

(this is my 3rd installation of ubuntu and I just broke it...)


Apparently on Ubuntu 18.04 LTS, docker 17.06.2-it needs to work with snap, I'm going to dig this way. I will try to return answer later...


Solution

  • I come back to you to give you the solution that allowed me to solve this problem.

    cannot perform operation: mount --rbind /var/snap /tmp/snap.rootfs_RRAjdq//var/snap: Permission denied
    

    I know why : https://bugs.launchpad.net/snapcraft/+bug/1620771 :

    When /home is a symlink snaps don't work.

    When /home is a real directory snaps work, see output below

    In my case :

    When /raid/snap is a symlink snaps don't work.

    When /var/snap is a real directory snaps work.

    I deleted docker. I had to reinstall snapcraf (snapd) because I was left on file modifications of it (wrong way)

    from there, I stopped the snapd service:

    sudo mv /var/snap/ /raid/snap
    sudo mount --rbind /raid/snap /var/snap
    

    I started the snapd service.

    sudo snap install docker
    

    sudo docker info <= to test

    sudo docker run hello-world <= to test

    I fixed my mount on fstab:

    /raid/snap      /var/snap      none      bind
    

    I restarted my OS : it worked, at least for my case. (I checked all along this file consistency handling to see if the docker files was going well on the raid...)