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

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s