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
?
相关问题
- Docker task in Azure devops won't accept "$(pw
- Unable to run mariadb when mount volume
- Unspecified error (0x80004005) while running a Doc
- What would prevent code running in a Docker contai
- How to reload apache in php-apache docker containe
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. (checkdocker --help
). You can have this setting applied automatically when Docker starts by adding it to /etc/default/dockerOn an AWS Ubuntu 16.04 Server I put the Docker images on a separate EBS, mounted on /home/ubuntu/kaggle/, under the docker dir
This snippet of my initialization script worked correctly
For Mac users in the 17.06.0-ce-mac19 version you can simply move the Disk Image location from the user interface in the preferences option Just change the location of the disk image and it will work (by clicking Move disk Image) and restarting the docker. Using this approach I was able to use my external hardisk for storing docker images.
In CentOS 6.5
add following line
then save the file and start docker again
and will make repository file in
/data/docker
For new docker versions we need to use
data-root
as from the official deprecated docs (Deprecated In Release: v17.05.0)On openSUSE Leap 42.1
Note that DOCKER_OPTS was initially empty and all I did was add in the argument to make docker use my new directory