Fedor  Petrov
Fedor Petrov

Reputation: 1050

Change default volume mount point for docker rootless?

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?

Upvotes: 2

Views: 1153

Answers (2)

punyidea
punyidea

Reputation: 173

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)

Upvotes: 1

Fedor  Petrov
Fedor Petrov

Reputation: 1050

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"

Upvotes: 2

Related Questions