I have Docker running on Windows with about five containers managed through a docker-compose.yml file.
I’ve recently set up an Ubuntu server, which is now functioning with Docker as well. However, I’m struggling to understand how to move my containers from Windows to Linux.
I initially thought it would be as simple as creating a backup with one click, then restoring it on the Ubuntu server. But I can’t seem to find any tool that easily transfers containers from one system to another or backs up the entire container along with its services.
I’m not a Docker expert, so I may have oversimplified this in my mind.
Some of the containers I’m working with include:
TeslaMate
WordPress
Nginx Proxy Manager
Any help or guidance would be greatly appreciated!
The containers are designed to be easily deleted and recreated, they’re not VMs
Since you already work with compose, I assume you know that, so do you perhaps mean you need to move the volumes / private images?
I’m sorry, I understand Compose a little, but I don’t really know what I’m doing. I also can’t find any information on how to move containers. I was hoping it would work like on a Hyper-V cluster
But there’s no Import/Export? No Backup/Restore… nothing.
Hello,
I managed to get TeslaMate working, the instructions for the DB export/import were good and worked.
Now I’m stuck with nginx.
As a test, I simply installed nginx, stopped it, copied all the folders over, but that only gave me errors that it could no longer load the certificates, even though they are all in the correct place.
version: "3"
services:
app:
image: 'jc21/nginx-proxy-manager:latest'
restart: unless-stopped
ports:
# These ports are in format <host-port>:<container-port>
- '80:80' # Public HTTP Port
- '443:443' # Public HTTPS Port
- '81:81' # Admin Web Port
# Add any other Stream port you want to expose
# - '21:21' # FTP
# Uncomment the next line if you uncomment anything in the section
# environment:
# Uncomment this if you want to change the location of
# the SQLite DB file within the container
# DB_SQLITE_FILE: "/data/database.sqlite"
# Uncomment this if IPv6 is not enabled on your host
# DISABLE_IPV6: 'true'
volumes:
- ./data:/data
- ./letsencrypt:/etc/letsencrypt
A little late, did you check both the host directory (./letsencrypt) and inside the container (/etc/letsencrypt) to ensure the correct files are there and have the correct permissions?
That is what the other two were referencing when speaking of Docker “migration”.
The compose file (or whatever file and method you use to “create” the Docker container) doesn’t change and is is just restarted on whatever system you want.
It’s the files that are stored on the host - those folders you are passing through via the “volumes” portion - that you need to copy over and ensure are in the same relative location on the new host.
You could put them all in a new top level folder named “npm” for example, and then the volumes section would read
I had already redone everything with Nginx. Now I’ve moved from Ubuntu to Debian.
Using mc, I copied both folders via SFTP to /tmp/nginxbackup, but directly into the compose in Portainer didn’t work. Then, I copied both folders from the backup folder into the compose folder. Boom, it worked.