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
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With