Data lost on docker restart

I’m facing an issue when docker or the host is restarted all data is gone. This is not happening when i just stop and restart the container.
I’m running a docker on Windows Desktop
Hier is my docker-compose file:

version: ‘2.1’

services:

squidex_mongo:

image: mongo:latest

ports:

  - "27017:27017"

volumes:

  - /etc/squidex/mongo/db:/data/db

networks:

  - internal

restart: unless-stopped

squidex_squidex:

image: "squidex/squidex:latest"

ports:

  - "80:80"

environment:

  - URLS__BASEURL=${SQUIDEX_PROTOCOL}://${SQUIDEX_DOMAIN}/

  - URLS__ENFORCEHTTPS=${SQUIDEX_FORCE_HTTPS}

  - EVENTSTORE__CONSUME=true

  - EVENTSTORE__MONGODB__CONFIGURATION=mongodb://squidex_mongo

  - STORE__MONGODB__CONFIGURATION=mongodb://squidex_mongo

  - IDENTITY__ADMINEMAIL=${SQUIDEX_ADMINEMAIL}

  - IDENTITY__ADMINPASSWORD=${SQUIDEX_ADMINPASSWORD}

  - IDENTITY__GOOGLECLIENT=${SQUIDEX_GOOGLECLIENT}

  - IDENTITY__GOOGLESECRET=${SQUIDEX_GOOGLESECRET}

  - IDENTITY__GITHUBCLIENT=${SQUIDEX_GITHUBCLIENT}

  - IDENTITY__GITHUBSECRET=${SQUIDEX_GITHUBSECRET}

  - IDENTITY__MICROSOFTCLIENT=${SQUIDEX_MICROSOFTCLIENT}

  - IDENTITY__MICROSOFTSECRET=${SQUIDEX_MICROSOFTSECRET}

  - LETSENCRYPT_HOST=${SQUIDEX_DOMAIN}

  - LETSENCRYPT_EMAIL=${SQUIDEX_ADMINEMAIL}

depends_on:

  - squidex_mongo

volumes:

  - /etc/squidex/assets:/app/Assets

networks:

  - internal

restart: unless-stopped

networks:

internal:

driver: bridge

Are you sure that the volume is working? It does not look like windows paths.

Hi Sebastian,

The list of docker volumes
DRIVER VOLUME NAME
local 4c730630498d8da2bca0fea6293fe43de4a6211cabd070364287a9876fabfa6f
local 39d24672f2dfa38b01371408c3df48602f3b5c3fe503ef05efdfb10682fbd2b7
local 257fd056fd3ecbf5046be90edc83f85b8f04bbb20707d37827de66a205f3af4e

I started from the github docker-compose yaml

Have you checked the folders in your host machine? Are there any files?

Hi Sebastian

Thank you for pointing me in the right direction. I changed my docker-compose file to use named volumes instead and seems this has solved the issue

version: ‘2.1’

services:

squidex_mongo:

image: mongo:latest

ports:

  - "27017:27017"

volumes:

  - data-docker:/data/db

networks:

  - internal

restart: unless-stopped

squidex_squidex:

image: "squidex/squidex:latest"

ports:

  - "80:80"

environment:

  - URLS__BASEURL=${SQUIDEX_PROTOCOL}://${SQUIDEX_DOMAIN}/

  - URLS__ENFORCEHTTPS=${SQUIDEX_FORCE_HTTPS}

  - EVENTSTORE__CONSUME=true

  - EVENTSTORE__MONGODB__CONFIGURATION=mongodb://squidex_mongo

  - STORE__MONGODB__CONFIGURATION=mongodb://squidex_mongo

  - IDENTITY__ADMINEMAIL=${SQUIDEX_ADMINEMAIL}

  - IDENTITY__ADMINPASSWORD=${SQUIDEX_ADMINPASSWORD}

  - IDENTITY__GOOGLECLIENT=${SQUIDEX_GOOGLECLIENT}

  - IDENTITY__GOOGLESECRET=${SQUIDEX_GOOGLESECRET}

  - IDENTITY__GITHUBCLIENT=${SQUIDEX_GITHUBCLIENT}

  - IDENTITY__GITHUBSECRET=${SQUIDEX_GITHUBSECRET}

  - IDENTITY__MICROSOFTCLIENT=${SQUIDEX_MICROSOFTCLIENT}

  - IDENTITY__MICROSOFTSECRET=${SQUIDEX_MICROSOFTSECRET}

  - LETSENCRYPT_HOST=${SQUIDEX_DOMAIN}

  - LETSENCRYPT_EMAIL=${SQUIDEX_ADMINEMAIL}

depends_on:

  - squidex_mongo

volumes:

  - data-assets:/app/Assets

networks:

  - internal

restart: unless-stopped

networks:

internal:

driver: bridge

volumes:

data-docker:

data-assets: