In the end I created a data container which has the volume mounted. Then the main and worker containers of sentry reference it in the “volumes_from” key in my docker-compose file:
sentry-data:
image: some.registry.com/repo/docker-sentry
volumes:
- /some/path/to/persistent/store/sentry:/var/lib/sentry/files:Z
command: /bin/true
sentry:
image: some.registry.com/repo/docker-sentry
restart: always
networks:
default:
aliases:
- sentry
depends_on:
- sentry-redis
- sentry-postgres
volumes_from:
- sentry-data
env_file: .env
worker-1:
image: some.registry.com/repo/docker-sentry
restart: always
depends_on:
- sentry-redis
- sentry-postgres
- sentry
volumes_from:
- sentry-data
env_file: .env
command: "sentry run worker --loglevel DEBUG"