Category Archives: devopt

Change default Docker folder

On Linux based machine, Docker uses /var/lib/docker as default home directory for all IO activities. Sometimes you don’t want your images, containers, etc going into that directory but other one eg /opt/docker

Here are some quick steps to make it happen (This example is on CentOS)

mkdir /opt/docker

vi /etc/sysconfig/docker

Then change other_args=”” configuration to be

# /etc/sysconfig/docker
# Other arguments to pass to the docker daemon process
# These will be parsed by the sysv initscript and appended
# to the arguments list passed to docker -d

other_args="-g /opt/docker"

Then restart docker

service docker stop
service docker start

If you want Docker to automatically start when your machine starts:

chkconfig docker on