devil0150
devil0150

Reputation: 1469

Changing path of docker containers in host system

It seems docker containers are stored in /var/lib/docker/containers. Can I change this? Can I make new containers appear in my home directory?

Do I need to build docker from source or is it an option that I can change when creating the container?

Upvotes: 0

Views: 48

Answers (1)

shizhz
shizhz

Reputation: 12501

You don't need to rebuild docker, it's an configurable option of docker daemon(dockerd), what you need to do is configuring it with option --graph(-g for short) and restart it, and migrate your existing docker data if necessary. An example config is:

/usr/bin/dockerd -H unix:///var/run/docker.sock -g /opt/docker/lib

And then your container info will be under /opt/docker/lib/containers, please refer to docs of dockerd for more configuration details.

Upvotes: 1

Related Questions