Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

move default docker container to another place on the disk

We are trying to figure out how to change the target place of the docker container. By default it is created in /var/lib/docker/containers. Lets say I would like to move it to /tmp/docker. All I could find so far was the docker volumes but it is not doing the thing the purpose of this usage is different.

What we want to do is to place the container in the RAM memory of the server so we can significantly reduce the time spent for building binaries.

Is it possible?

Regards, Jordan

like image 923
Jordan Kostov Avatar asked Mar 19 '15 15:03

Jordan Kostov


People also ask

How do I change the path of a container?

The default path for the config file is located at /etc/containerd/config. toml . You can change this path via the --config,-c flags when booting the daemon.


1 Answers

See by @thaJeztah https://github.com/docker/docker/issues/3127

It's also possible to use a daemon.json configuration file instead of /etc/default/docker. The /etc/default/docker is only used for systems running upstart, and not for systems running systemd, so is more portable. Also it allows reloading some configuration settings without restarting the daemon;

https://docs.docker.com/engine/reference/commandline/daemon/#daemon-configuration-file

E.g

I'm on Ubuntu 16.04.1, but it shouldn't matter because this is a cross-distro solution.

Just put this json into /etc/docker/daemon.json:

{
"data-root": "/path/to/docker"
}

For the older versions it was "graph" option:

{
"graph": "/path/to/docker"
}

Worked for me and I didn't have to mess with upstart or systemd.

like image 131
Amos Folarin Avatar answered Oct 24 '22 12:10

Amos Folarin