且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何更改docker镜像安装目录?

更新时间:2023-11-24 17:53:16

使用最新版本的 Docker,您可以在 中将 data-root 参数的值设置为您的自定义路径/etc/docker/daemon.json(根据 https://docs.docker.com/engine/reference/commandline/dockerd/#daemon-configuration-file).

With recent versions of Docker, you would set the value of the data-root parameter to your custom path, in /etc/docker/daemon.json (according to https://docs.docker.com/engine/reference/commandline/dockerd/#daemon-configuration-file).

对于旧版本,您可以在启动 Docker 守护程序时使用 -g 选项更改 Docker 的存储基础目录(容器和图像所在的位置).(检查docker --help).您可以在 Docker 启动时自动应用此设置,方法是将其添加到 /etc/default/docker

With older versions, you can change Docker's storage base directory (where container and images go) using the -goption 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