Good evening,
I have a Nextcloud App running inside Docker on a Virtual Private Server. It works, but I want to test some changes. What I want to do is to move my complete setup from VPS A to VPS B, test the changes on Server B, so they do not affect my working system and when the test was successful I can apply them on server A. What is the best way to do that? Furthermore I thought about to build a backup method from this attempt. First of all I want that the test environment works, but I am also interested in your thoughts about a backup solution based on moving containers.
What I tried first is to export my containers on server A, move them to server B and import them. I used:
docker export name > name.tar
docker import name.tar name
When I tried to run the image with:
docker run name
I got the following error:
docker: Error response from daemon: No command specified.
What I tired next is to commit and save on server A and to load on server B. I used:
docker commit name name
docker save name > name.tar
and
docker load < name.tar
When I tried to run the image with:
docker run name
I got the following error:
docker: Error response from daemon: cannot mount volume over existing file, file exists /var/lib/docker/overlay2/6c07b6c68fe0d86adf00cc385bc4022b0da5366b2db2835e1edc721a55506ed5/merged/tmp/docker.sock.
Do you have any suggestions how to solve the problem? Should the commit-save-load attempt work?
I am also wondering if I need a dockerfile on server B or is it sufficient to just load and run the images in an arbitrary order?
I used the following docker file to create the setup on server A:
# to start the service use:
# sudo docker network create proxy-tier
# sudo docker-compose up -d
# source: https://github.com/nextcloud/docker/tree/master/.examples/docker-compose/with-nginx-proxy/mariadb/apache
version: '3'
services:
db:
image: mariadb
command: --transaction-isolation=READ-COMMITTED --binlog-format=ROW
restart: always
volumes:
- db:/var/lib/mysql
environment:
- MYSQL_ROOT_PASSWORD=xxx
env_file:
- db.env
app:
image: nextcloud:apache
restart: always
volumes:
- nextcloud:/var/www/html
environment:
- VIRTUAL_HOST=xxx
- LETSENCRYPT_HOST=xxx
- LETSENCRYPT_EMAIL=xxx
- MYSQL_HOST=db
env_file:
- db.env
depends_on:
- db
networks:
- proxy-tier
- default
proxy:
build: ./proxy
restart: always
ports:
- 80:80
- 443:443
labels:
com.github.jrcs.letsencrypt_nginx_proxy_companion.nginx_proxy: "true"
volumes:
- certs:/etc/nginx/certs:ro
- vhost.d:/etc/nginx/vhost.d
- html:/usr/share/nginx/html
- /var/run/docker.sock:/tmp/docker.sock:ro
networks:
- proxy-tier
letsencrypt-companion:
image: jrcs/letsencrypt-nginx-proxy-companion
restart: always
volumes:
- certs:/etc/nginx/certs
- vhost.d:/etc/nginx/vhost.d
- html:/usr/share/nginx/html
- /var/run/docker.sock:/var/run/docker.sock:ro
networks:
- proxy-tier
depends_on:
- proxy
volumes:
db:
nextcloud:
certs:
vhost.d:
html:
networks:
Operating system and version: Ubuntu 20.04.3 LTS
Docker version: 20.10.10
Nextcloud version: 21.0.0
Please let me know if I can provide further information and thank you for your help.