如何更改docker映像安装目录? [英] How to change the docker image installation directory?

查看:120
本文介绍了如何更改docker映像安装目录?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

从我可以看出,泊坞窗图像被安装到 / var / lib / docker 中。有没有办法改变这个位置,比如一个挂载的卷,如 / mnt

解决方案使用最新版本的Docker,您可以将图形的值参数设置为您的自定义路径, / 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 -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

这篇关于如何更改docker映像安装目录?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆