How can I change the location of image?


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

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

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?

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!

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)

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

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

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