如何更改docker映像安装目录? [英] How to change the docker image installation directory?
问题描述
从我可以看出,泊坞窗图像被安装到 / var / lib / docker
中。有没有办法改变这个位置,比如一个挂载的卷,如 / mnt
?
图形的值参数设置为您的自定义路径, / etc / docker / daemon.json
(根据 https://docs.docker.com/v1.11/engine/reference/commandline/daemon/#daemon-configuration-file )。
对于旧版本,您可以在启动Docker守护程序时使用 -g
选项更改Docker的存储基础目录(容器和图像的位置)。 (检查 docker --help
)。
当Docker启动时,您可以自动应用此设置,将其添加到 / etc / default / docker
From what I can tell, docker images are installed to /var/lib/docker
as they are pulled. Is there a way to change this location, such as to a mounted volume like /mnt
?
解决方案 With recent versions of Docker, you would set the value of the graph
parameter to your custom path, in /etc/docker/daemon.json
(according to https://docs.docker.com/v1.11/engine/reference/commandline/daemon/#daemon-configuration-file).
With older versions, you can change Docker's storage base directory (where container and images go) using the -g
option when starting the Docker daemon. (check docker --help
).
You can have this setting applied automatically when Docker starts by adding it to /etc/default/docker
这篇关于如何更改docker映像安装目录?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!