How to “move” docker to a different location – Debian 10.

Some times docker images can be big and if you have many of them this could cause some issues.

I have worked with non-default location for docker for a while and for my needs it worked out pretty well.

Searching the internet, there are a bunch of references on how to do this change.

I have done:

systemctl stop docker

vim /lib/systemd/system/docker.service
# here I have changed:
# ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
# to
# ExecStart=/usr/bin/dockerd -g /foobar -H fd:// --containerd=/run/containerd/containerd.sock

systemctl daemon-reload
systemctl start docker

So the -g /foobar option allows you to “rebase” docker in the system.

References

https://linuxconfig.org/how-to-move-docker-s-default-var-lib-docker-to-another-directory-on-ubuntu-debian-linux

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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