My docker-compose experiments filled up the 50G SSD partition pretty quick. I still had 500 GB of my 1TB drive unallocated, so I figured out how to make a mount, then symlinked the docker dir there.

Format the partition

(Linux Mint UI) Menu > Disks > 1.0 TB Hard Disk > Unallocated > + > Ext4

Investigate the file system

1
df -h

I saw a new /dev/db3 device

Mount the device

1
sudo mount /dev/sdb3 /mnt

note: to mount on subsequent reboots:

WARNING: make a backup and verify before rebooting. This changing fstab could prevent your machine from booting.

https://askubuntu.com/a/154184/514799

Add this line to /etc/fstab:

1
/dev/sdb3     /mnt     ext4    defaults    0    1

Stop and remove all images

http://blog.baudson.de/blog/stop-and-remove-all-docker-containers-and-images

1
2
3
4
5
6
7
8
# List all containers (only IDs)
docker ps -aq
# Stop all running containers
docker stop $(docker ps -aq)
# Remove all containers
docker rm $(docker ps -aq)
# Remove all images
docker rmi $(docker images -q)

Symlink the docker dir to the mount

https://forums.docker.com/t/how-do-i-change-the-docker-image-installation-directory/1169

  1. Become su: su
  2. Make target dirs: mkdir -p /mnt/pd0/docker
  3. Stop docker: service docker stop. Verify no docker process is running ps faux
  4. Double check docker really isn’t running. Take a look at the current docker directory: ls /var/lib/docker/
  5. 2b) Make a backup - tar -zcC /var/lib docker > /mnt/pd0/var_lib_docker-backup-$(date +%s).tar.gz
  6. Move the /var/lib/docker directory to your new partition: mv /var/lib/docker /mnt/pd0/docker
  7. Make a symlink: ln -s /mnt/pd0/docker /var/lib/docker
  8. Take a peek at the directory structure to make sure it looks like it did before the mv: ls /var/lib/docker/ (note the trailing slash to resolve the symlink)
  9. Start docker back up service docker start
  10. deactivate su: exit
  11. restart your containers

This is a potential candidate for ansibleization