Migrating Docker from Digital Ocean to home


After setting up my home server, and being assigned a static public IP address by SSE it makes sense to move all the projects I can here (and the bill was getting to be $20+ per month). This isn’t foolproof.

Docker

So what is this actually running?

  • Traefik
  • Watchtower
  • Portainer
  • Jekyll
  • Django
  • PostgreSQL10
  • MariaDB
  • Dovecot
  • Postfix
  • phpPgAdmin

This server is primarly for ma.ax and my email server, along with a couple of databases for smaller projects.

Set up the VM

Set up for the VM was pretty normal:

  • Provision 2GB RAM, 2 vCPU, 120GB HDD on Proxmox
  • Set up Ubuntu 18.04.02LTS server
  • Update Ubuntu and install Docker
  • Set a static IP on LAN with netplan

Set up NAT rules for the new server

Next step was to set up NAT on my PfSense router.

  • First enable NAT under System -> Advanced -> Network Address Translation
    • NAT Reflection mode for port forwards [NAT + Proxy]
    • Enable NAT Reflection for 1:1 Nat [True]
    • TFTP Proxy [WAN]
  • Second Set up NAT rules under Firewall-> NAT -> ADD
    • Add a rule for every port I needed open for ma.ax [22, 80, 443,…]

Save and export the Docker images

Now, I’m not sure that this is the best way, but it worked flawlessly for me. First export the containers.

docker save $(docker images | sed '1d' | awk '{print $1 ":" $2 }') -o allinone.tar

Copy them to the new host with scp:

scp allinone.tar user@176.35.31.230:~/

Load the containers on the new host as root

docker load -i allinone.tar

Copy the mounted volumes over, and adjust your docker-compose file:

scp -r /opt/maax_docker/ user@176.35.31.230:/opt/

Call docker-compose to bring up the containers:

docker-commose up -d 	

Finally, update your DNS settings to point to the new IP, for me this was on cloudflare.

Related

PfSense DNS Resolver with PiHole DNS forwarder for network-wide ad-blocking

Configuring Unbound on PfSense as a DNS Resolver to register DHCP hostnames on localdomain and using PiHole as a DNS Forwarder to perform network-wide ad-blocking.

Setting up a Greylog server for central logging with Ansible

Learning how to use Ansible through setting up a Graylog server for centralised syslogging.

Proxmox Setup v2 - moving root onto an SSD and away from the ZFS array

Moving away from ZFS on root, and using it for the HDD array.

Proxmox host migration; new Home Server day

A workbook of migrating Proxmox to a new host for the first time.

Setting up a VLAN with PfSence

A quick introduction to setting up VLANs with PfSence for a guest network.

Simulating Spin-Echo Metabolite NMR / MR Spectra with PyGamma (VeSPA)

How to simulate MR metabolite spectra with PyGamma, including binning and plotting.

Converting a BBC Micro keyboard to USB with an Arduino Micro (ATmega 32U4)

Using an Arduino to turn a BBC Micro keyboard to be USB compatible.