1

I saw this post with different solutions for standard docker installation: How to change the default location for "docker create volume" command?

At first glance I struggle to repeat the steps to change the default mount point for the rootless installation. Should it be the same? What would be the procedure?

Fedor Petrov
  • 990
  • 9
  • 19
  • I am having the same issue. I've tried changing the config file in the directory under "Usage" as mentioned in https://docs.docker.com/engine/security/rootless/. I'm trying to see if this can be fixed – punyidea Apr 26 '22 at 13:50
  • 1
    Hi, i published an answer, the way we kind of solved the issue indirectly. We didn't figure it out with docker configs directly, so we used symbolic link for the default docker volume diectory to point to the location where we actually want to store the data. – Fedor Petrov Apr 26 '22 at 14:04
  • Thanks, I finally got it working just after commenting and submitted an answer – punyidea Apr 26 '22 at 14:16

2 Answers2

1

We ended up with the indirect solution. We have identified the directory where the volumes are mounted by default and created a symbolic link which points to the place where we actually want to store the data. In our case it was enough. Something like that:

sudo ln -s /data /home/ubuntu/.local/share/docker/volumes"
Fedor Petrov
  • 990
  • 9
  • 19
1

I just got it working. I had some issues because I had the service running while trying to change configurations. Key takeaways:

  1. The config file is indeed stored in ~/.config/docker/. One must make a daemon.json file here in order to change preferences. We would like to change the data-root option (and storage-driver, in case the drive does not have capabilities

  2. To start and stop the headless service one runs systemctl --user [start | stop] docker.

    a. Running the systemwide service starts a parallel and separate instance of docker, which is not rootless.

    b. When stopping make sure to stop the docker.socketfirst.

Sources are (see Useage section for rootless) and (config file information)

punyidea
  • 173
  • 1
  • 9