Docker Community Forums

Share and learn in the Docker community.

How can I change the location of image?

(Gps1539) #1


Is there a way to change the directory where images will be placed. By default they go under /var/lib/docker, but this is pushing my / partition to be tight on free space

(Usertaken) #2

I have /var/lib/docker symlinked to another folder on another partition. You can also mount a dedicated partition for docker.

(Gps1539) #3

Hi, thanks for the reply.

Isn’t there a way to config docker to use something like an NFS volume which could be shared between servers?

(Sven Dowideit) #4

Docker will use whatever directory you tell it to use - see the -g or --graph flag for the Docker daemon.

I’m not at all sure that using NFS is going to perform well, but if you do try it - please consider blogging about it!

(Gps1539) #5

Thanks for the reply.

Do you know the syntax for --graph?

I’m getting “flag provided but not defined: --graph” when I try (as root)

#docker run -i -t --graph="/mnt/freenas/docker" ubuntu
#docker run -i -t --graph=/mnt/freenas/docker ubuntu
#docker run -i -t --graph /mnt/freenas/docker ubuntu

same even with
#docker run -i -t --graph="/var/lib/docker" ubuntu (copied from help output)

(Gps1539) #6

figured it out, the option needs to be defined before the command

docker -g=/mnt/freenas/docker run -t -i ubuntu

(Sven Dowideit) #7

the --graph option is not a docker run option - its a daemon option.

mmm, I’ve made , but having been in that code, I’m not sure it’ll be a quick fix until the -d option is replaced with docker daemon