Docker upgrade

Support for the docker image maintained by dlandon
Post Reply
EK701
Posts: 24
Joined: Thu Feb 06, 2020 4:26 pm

Docker upgrade

Post by EK701 »

I’m currently running the 1.32.4 dlandon docker image. What is the proper way to upgrade to the 1.34 docker image without losing my existing configuration and database?

Thanks!
User avatar
snake
Posts: 337
Joined: Sat May 21, 2016 2:20 am

Re: Docker upgrade

Post by snake »

I can't speak for docker w/zm (hopefully someone else will chime in) but you can always backup the db and then go back / restore should something go wrong.

For docker, a quick search online comes up with this command for backing up a mysql db:

Code: Select all

# Backup
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql

# Restore
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE
In ZM, if you have the db, you have the configuration. You may lose events, however.
EK701
Posts: 24
Joined: Thu Feb 06, 2020 4:26 pm

Re: Docker upgrade

Post by EK701 »

Just a follow up that I upgraded my zoneminder docker installation using the typical docker upgrade path (docker stop, rm, run a new instance) without any issues.
warcanoid
Posts: 35
Joined: Mon Feb 17, 2020 3:22 pm

Re: Docker upgrade

Post by warcanoid »

If I can ask here. I have mounted a second internal drive to ZM. Added disk to fstab in host and docker. But on system reboot docker wont auto mount disk(only host do it). How can I make auto mount disk persistent in docker?

EDIT: Have reinstalled Zoneminder with `v "/media/zm":"/mnt/ZM`, and working with path /mnt/ZM
```
sudo docker run -d --name="Zoneminder" --net="bridge" --privileged="true" -p 888:80/tcp -p 9001:9001/tcp -e TZ="Europe/Berlin" -e SHMEM="50%" -e PUID="99" -e PGID="100" -e INSTALL_HOOK="1" -e INSTALL_FACE="1" -e INSTALL_TINY_YOLO="1" -e INSTALL_YOLO="1" -v "/mnt/Zoneminder":"/config":rw -v "/mnt/Zoneminder/data":"/var/cache/zoneminder":rw -v "/media/zm":"/mnt/ZM":rw dlandon/zoneminder
```
dlandon
Posts: 17
Joined: Fri Oct 12, 2018 12:49 am

Re: Docker upgrade

Post by dlandon »

All you have to do is restart the docker and ZM wll be updated. All database files and setup are kept in the /config/ folder. Thus is the nice thing about dockers, your data is not kept in the docker image. You can delete the image and re-install it and your database and settings will be kept.

If you are updating the docker itself, you will have to remove it and re-install the docker.
Minglarn
Posts: 7
Joined: Mon Sep 14, 2020 7:57 am

Re: Docker upgrade

Post by Minglarn »

So for a noob like me, how would the upgrade process be if I consider upgrading your docker?

//Best regards...
Magic919
Posts: 1381
Joined: Wed Sep 18, 2013 6:56 am

Re: Docker upgrade

Post by Magic919 »

If you want to upgrade ZM ,then restart the Docker container.
-
Minglarn
Posts: 7
Joined: Mon Sep 14, 2020 7:57 am

Re: Docker upgrade

Post by Minglarn »

You mean by doing:

Code: Select all

docker rm Zoneminder
and

Code: Select all

docker run -d --name="Zoneminder" \
--net="bridge" \
--privileged="true" \
-p 8443:443/tcp \
-p 9001:9001/tcp \
-e TZ="SE/Stockholm" \
-e SHMEM="50%" \
-e PUID="99" \
-e PGID="100" \
-e INSTALL_HOOK="1" \
-e INSTALL_FACE="1" \
-e INSTALL_TINY_YOLOV3="0 \
-e INSTALL_YOLOV3="0" \
-e INSTALL_TINY_YOLOV4="1" \
-e INSTALL_YOLOV4="" \
-e MULTI_PORT_START="0" \
-e MULTI_PORT_END="0" \
-v "/mnt/Zoneminder":"/config":rw \
-v "/mnt/Zoneminder/data":"/var/cache/zoneminder":rw \
dlandon/zoneminder
Magic919
Posts: 1381
Joined: Wed Sep 18, 2013 6:56 am

Re: Docker upgrade

Post by Magic919 »

Yes, a stop, rm, run should do it. For other images I usually run a pull, but above here you can see the author says restart is enough.
-
Minglarn
Posts: 7
Joined: Mon Sep 14, 2020 7:57 am

Re: Docker upgrade

Post by Minglarn »

Great.. Just needed to be sure... Did a restart but it did not pull the newest container...
Thanks.
Post Reply