Docker for Windows: CMS is reset when I restart the host server

I have come across a potential solution to this and if there’s any volunteers who’d like to test and feedback that would be appreciated.

Assuming you use the standard docker-compose.yml file, copy the following in to a new file docker-compose.override.yml in the same directory.

version: "2.1"

services:
    cms-db:
        restart: "no"
    cms-xmr:
        restart: "no"
    cms-web:
        restart: "no"
    cms-autostart:
        restart: always
        image: shaynesweeney/holdup
        volumes:
            - "./shared/holdup:/test"
            - "/var/run/docker.sock:/var/run/docker.sock"

Now inside your shared folder, create a new folder called holdup. Inside that folder, put any file. There must be at least one file in that directory. You can create a new empty document, or put an image in there, whatever. As long as there’s one file.

Now run docker-compose up -d.

That will recreate all the containers and stop the Xibo ones automatically starting. Now restart the computer. When Docker is run after reboot, only the holdup container will start automatically. If it finds that the shared/holdup directory is empty (ie the volume mount isn’t working properly), then it won’t start the Xibo containers. It will check periodically. Once it sees that there is something in the shared/holdup directory, it knows the volume mount is working and will start any stopped containers inside the Docker system. That’s perfect assuming you’re only running the Xibo containers there.

If you’re using the cms_custom-ports.yml file, then you can copy the above as any file name you like - eg holdup.yml. You then invoke any command involving docker-compose referencing both files

docker-compose -f cms_custom-ports.yml -f holdup.yml up -d
docker-compose -f cms_custom-ports.yml -f holdup.yml down
docker-compose -f cms_custom-ports.yml -f holdup.yml stop
docker-compose -f cms_custom-ports.yml -f holdup.yml start

for example. The other instructions all remain the same