Change docker data directory

There are other ways to do this, but a simple one is to replace the default directory with a symbolic link to wherever you want to have your data directory. This is tested with OpenSuse LEAP 42.3.

Stop docker (if it is running):

service docker stop

Move the contents of the docker default data directory (under Suse this is /var/lib/docker/) to somewhere else:

mv /var/lib/docker/ /path/to/new/folder/

Now create a symbolic link to the new location in place of the default directory:

ln -s /path/to/new/folder/ /var/lib/docker/

Start docker again, it should use the new location:

service docker stop

(PS: In my case I had not deleted all containers and images before, so I had some things that linux didn’t want to move to the new location. I just deleted them manually:)

btrfs subvolume delete btrfs/subvolumes/*

sshfs – mount files over ssh

Mount a file system on a different computer via ssh:

sshfs -o follow_symlinks user@server:/home/user/ /path/to/mount/point

server is the other computer, user is your username on the other computer and /home/user/ is the folder you want to include from the other computer. /path/to/mount/point is the place on your drive where the files will be located. It needs to be a folder that exists and is empty.

To get rid of the mounted folder again use

umount /path/to/mount/point