Hello Team…
Hoping Doing Well…
How To Restore a Backup in installation Via Docker?
I know restore in Easy Scrip Installed But don’t know in Docker.
And Backup from Easy Script and Restore in Docker.
restore mariadb: How to restore MySQL dump from host to Docker container - Stack Overflow
restore files: How to copy files from host to Docker container? - Stack Overflow
But Which Container in Case of ERPNext?
And I have sql.gz backup file.
files will need to be placed in “sites” volume, access it using any container that mounts it.
db needs to be restored in mariadb, use mariadb container for that.
.sql.gz
extract it and use command from here:
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE
I was a many try but showing error…
root@tecis4:~# cd ..
root@tecis4:/# cd var/lib/docker
root@tecis4:/var/lib/docker# ls
buildkit containers image network overlay2 plugins runtimes swarm tmp trust volumes
root@tecis4:/var/lib/docker# cd containers
root@tecis4:/var/lib/docker/containers# ls
0c0a1938e4a20269aa89e783106edd6d9871dda2ab5b27426f7eb21aea789cbd a1a41dfc4b68854269a56a711be7e700f59df1fe2a06240cdc3809d97bd6bb2f
3bcbe8be2d4f050754227ec03d3b88011c6fa6760ccc5ed805cf43f99bcdc1a3 a1ffbe6511f9754b25a289b7f97ddb18862a499e13ba47b65d06ba9e451aa522
449d7e9c805a656cf39734798264a2f6423eb9a7740ff99fec14dc09bb9b0c2e add31a6c886e3c6dd7436dc92dc6a1060dcbcf91c640b6a4fb1db11ca71416b1
5d455b23d22dd6f4e4ee5de9f521ea1f53cb5e385020a7bf5fec9d8634b390eb b0bdaf5837d5412ad89a547044111fb5b3a3d52eacb4085d48edb2ca45164d75
9833d177bf0c273fe53e37e440da4f4cac0c552562b91e31f3275429a1ed7376 b8db68182226a642bd278a4d31fdf8aac482a19bbe7c4f30294cd9fefb9bd589
99eb56b7079fdef34c498ce09d50849cfdfc2d719679e83cd3eb84fc01324d28 ba13702b7fb7587bee213a323d51d9e9b2f0cff5abcb4842a729125bb81245e5
9ab4a06de5852f3c068b07c00f33dd704a90ec72095b0488d2ffa5f4531faad7 e805070b5d9621a560716d6d8e871d9f9c8a44aac71070bb7e505a94c0ec9c52
root@tecis4:/var/lib/docker/containers# cd ..
root@tecis4:/var/lib/docker# cd volumes
root@tecis4:/var/lib/docker/volumes# docker logs portainer_agent -f
Error: No such container: portainer_agent
root@tecis4:/var/lib/docker/volumes# cat 20210518_113002-site1_local-database.sql | docker exec -i erpnext_sites-vol /usr/bin/mysql -u root
cat: 20210518_113002-site1_local-database.sql: No such file or directory
Error: No such container: erpnext_sites-vol
root@tecis4:/var/lib/docker/volumes# cat 20210518_113002-site1_local-database.sql | docker exec -i erpnext /usr/bin/mysql -u root
cat: 20210518_113002-site1_local-database.sql: No such file or directory
Error: No such container: erpnext
root@tecis4:/var/lib/docker/volumes# cat 20210518_113002-site1_local-database.sql | docker exec -i erpnext/usr/bin/mysql -u root
cat: 20210518_113002-site1_local-database.sql: No such file or directory
Error: No such container: erpnext/usr/bin/mysql
root@tecis4:/var/lib/docker/volumes#
If you read the links I shared before you may understand how to interact with docker containers and volumes.
There may be easier way, (given you have reasonable sized data to be uploaded and downloaded)
Push your current setup to S3 compatible storage. GitHub - frappe/frappe_docker: Docker images for production and development setups of the Frappe framework and ERPNext
Restore sites from cloud. frappe_docker/site-operations.md at main · frappe/frappe_docker · GitHub
I don’t have storage.
and
whare i put backup.sql file.
root@tecis4:/# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
9ab4a06de585 frappe/erpnext-worker:edge "docker-entrypoint.s…" 24 hours ago Up 24 hours erpnext_erpnext-worker-default_1
9833d177bf0c frappe/erpnext-worker:edge "docker-entrypoint.s…" 24 hours ago Up 24 hours erpnext_erpnext-worker-short_1
449d7e9c805a frappe/erpnext-worker:edge "docker-entrypoint.s…" 24 hours ago Up 24 hours erpnext_erpnext-schedule_1
0c0a1938e4a2 frappe/erpnext-worker:edge "docker-entrypoint.s…" 24 hours ago Up 24 hours erpnext_erpnext-worker-long_1
a1a41dfc4b68 frappe/frappe-socketio:edge "docker-entrypoint.s…" 24 hours ago Up 24 hours erpnext_frappe-socketio_1
b0bdaf5837d5 frappe/erpnext-worker:edge "docker-entrypoint.s…" 24 hours ago Up 24 hours erpnext_erpnext-python_1
5d455b23d22d redis:latest "docker-entrypoint.s…" 24 hours ago Up 24 hours 6379/tcp erpnext_redis-socketio_1
a1ffbe6511f9 redis:latest "docker-entrypoint.s…" 24 hours ago Up 24 hours 6379/tcp erpnext_redis-queue_1
ba13702b7fb7 frappe/erpnext-nginx:edge "/docker-entrypoint.…" 24 hours ago Up 24 hours 80/tcp erpnext_erpnext-nginx_1
add31a6c886e mariadb:10.3 "docker-entrypoint.s…" 24 hours ago Up 24 hours 3306/tcp erpnext_mariadb_1
99eb56b7079f traefik:v2.2 "/entrypoint.sh --lo…" 24 hours ago Up 24 hours 0.0.0.0:80->80/tcp, 0.0.0.0:443->443/tcp erpnext_traefik_1
b8db68182226 redis:latest "docker-entrypoint.s…" 24 hours ago Up 24 hours 6379/tcp erpnext_redis-cache_1
3bcbe8be2d4f portainer/agent "./agent" 2 weeks ago Up 2 weeks portainer_edge_agent
root@tecis4:/# ls
bin boot data dev etc home lib lib32 lib64 libx32 lost+found media mnt opt proc root run sbin snap srv sys tmp usr var
root@tecis4:/# cd var
root@tecis4:/var# ls
backups cache crash lib local lock log mail opt run snap spool tmp
root@tecis4:/var# cd lib
root@tecis4:/var/lib# ls
apt containerd docker grub nfs pam python sudo ubuntu-fan unattended-upgrades
boltd dbus dpkg initramfs-tools oracle-cloud-agent polkit-1 shim-signed systemd ubuntu-release-upgrader update-manager
cloud dhcp git misc os-prober private snapd tpm ucf update-notifier
root@tecis4:/var/lib# cd docker
root@tecis4:/var/lib/docker# ls
buildkit containers image network overlay2 plugins runtimes swarm tmp trust volumes
root@tecis4:/var/lib/docker# cd volume
-bash: cd: volume: No such file or directory
root@tecis4:/var/lib/docker# cd volumes
root@tecis4:/var/lib/docker/volumes# ls
0502b2ef14ab69e311bc787b3ddbdf144afef383e33f93680d550ee8272038c4 da5ab5faebe072fc2441e7ebfdf7c4690afeb5509b5d05d1735b6b6876e50091 erpnext_redis-queue-vol
6426c0d3fe843b7b4bcd674764ef7d3613e689f9979bfa5b45a0e39bff513dee df3a63760e02ffc82f46a31408c79b46fd7a626279cb0d75c3ce61bc6a037575 erpnext_redis-socketio-vol
86bb191c7a388c7074dd525d3c588a1ca1f8edeab0507dad8b7622c241bcd4b2 erpnext_assets-vol erpnext_sites-vol
8f38594b6d7eba5ba60fe834b2d3ddf3d13571e647b3a323d771981918dffc7c erpnext_cert-vol metadata.db
ae05f8886b572ceea71dfcaf82c43bc85ed4ba3b4311459192bc619e7685a033 erpnext_logs-vol portainer_agent_data
backingFsBlockDev erpnext_mariadb-vol
d41d31b093e7e25e75afd32cabcd8adedb4d88d77abfde1bfe1d31bebf8c34e9 erpnext_redis-cache-vol
root@tecis4:/var/lib/docker/volumes# docker cp tmp/20210518_113002-site1_local-database.sql add31a6c886e3c6dd7436dc92dc6a1060dcbcf91c640b6a4fb1db11ca71416b1:usr/bin/mysql/20210518_113002-site1_local-database.sql
lstat /var/lib/docker/volumes/tmp: no such file or directory
root@tecis4:/var/lib/docker/volumes#
root@tecis4:/var/lib/docker/volumes# docker cp tmp/20210518_113002-site1_local-database.sql add31a6c886e3c6dd7436dc92dc6a1060dcbcf91c640b6a4fb1db11ca71416b1:20210518_113002-site1_local-database.sql
lstat /var/lib/docker/volumes/tmp: no such file or directory
root@tecis4:/var/lib/docker/volumes# cd
root@tecis4:~# docker cp tmp/20210518_113002-site1_local-database.sql add31a6c886e3c6dd7436dc92dc6a1060dcbcf91c640b6a4fb1db11ca71416b1:20210518_113002-site1_local-database.sql
lstat /root/tmp: no such file or directory
root@tecis4:~# cd tm
-bash: cd: tm: No such file or directory
root@tecis4:~# cd tmp
-bash: cd: tmp: No such file or directory
root@tecis4:~# ll
total 36
drwx------ 6 root root 4096 May 18 13:12 ./
drwxr-xr-x 20 root root 4096 May 5 13:04 ../
-rw------- 1 root root 3178 May 18 14:08 .bash_history
-rw-r--r-- 1 root root 3106 Dec 5 2019 .bashrc
drwx------ 2 root root 4096 May 18 13:12 .cache/
drwxr-xr-x 3 root root 4096 May 6 12:04 .local/
-rw-r--r-- 1 root root 161 Dec 5 2019 .profile
drwx------ 2 root root 4096 May 2 15:59 .ssh/
drwxr-xr-x 3 root root 4096 May 2 16:00 snap/
root@tecis4:~# cd ..
root@tecis4:/# docker cp tmp/20210518_113002-site1_local-database.sql add31a6c886e3c6dd7436dc92dc6a1060dcbcf91c640b6a4fb1db11ca71416b1:20210518_113002-site1_local-database.sql
Error response from daemon: Error processing tar file(exit status 1): cannot overwrite non-directory "/20210518_113002-site1_local-database.sql/20210518_113002-site1_local-database.sql" with directory "/20210518_113002-site1_local-database.sql"
root@tecis4:/# cat 20210518_113002-site1_local-database.sql | docker exec -i add31a6c886e3c6dd7436dc92dc6a1060dcbcf91c640b6a4fb1db11ca71416b1 /usr/bin/mysql -u root --password=admin
cat: 20210518_113002-site1_local-database.sql: No such file or directory
root@tecis4:/#
After the last post,
I was tried copy the database file in Container name<erpnext_mariadb_1> in my case.
and
command docker exec -i erpnext_mariadb_1
then cat backup.sql
runs something like backup restoring but not work.