如何更改默认的Docker容器位置? [英] How do I change the default docker container location?

查看:291
本文介绍了如何更改默认的Docker容器位置?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我运行docker时,下载的docker映像(似乎是)存储在 / var / lib / docker 某处。

When I run docker, downloaded docker images (seem to be) stored in /var/lib/docker somewhere.

由于该目录上的磁盘空间有限,因此我要同时将docker设置到多台计算机;有没有办法将此默认位置更改为 / mnt / hugedrive / docker /

Since disk space is limited on this directory, and I'm provisioning docker to multiple machines at once; is there a way to change this default location to i.e. /mnt/hugedrive/docker/?

推荐答案

您可以使用 -g 选项和您选择的目录来启动Docker守护程序。

You can start the Docker daemon using -g option and the directory of your choice. This sets the appropriate runtime for Docker.

对于版本1.8,应该类似于:

With version 1.8, it should be something like:

docker daemon -g /path/to/directory

对于早期版本,可能是:

With earlier versions, it would be:

docker -d -g /path/to/directory

从手册页:

-g, --graph=""
     Path to use as the root of the Docker runtime. Default is /var/lib/docker.

这篇关于如何更改默认的Docker容器位置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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