cookiecutter-django icon indicating copy to clipboard operation
cookiecutter-django copied to clipboard

Wrong option for postgres volume mounts in compose files

Open gabrielelucci opened this issue 2 years ago • 3 comments

Both in the local.yml and production.yml compose file, the postgres mounts are defined like this

volumes:
    - production_postgres_data:/var/lib/postgresql/data:Z
    - production_postgres_data_backups:/backups:z

However, why is the z/Z option there?

docker-compose v2.4.1, even complains about this, reporting the following warning:

mount of type `volume` should not define `bind` option

That's because the syntax defines a volume mount but the z/Z option is for bind mounts and that's incompatible. Shouldn't the option be removed?

gabrielelucci avatar Apr 26 '22 10:04 gabrielelucci

This was added as part of https://github.com/cookiecutter/cookiecutter-django/pull/2663 and I don't think I noticed any issues on macOs at the time... Which OS are you on? Maybe that's no longer applicable and should be reverted.

browniebroke avatar Apr 27 '22 15:04 browniebroke

I use Arch Linux, so I'm on the latest Linux kernel and docker and docker-compose versions.

gabrielelucci avatar Apr 27 '22 16:04 gabrielelucci

Reading the #2663 PR, I think it's actually a good idea to have them in the django service volumes in local.yml compose. but I don't think it even has any effect on the postgres service volumes, since it is an incompatible option. I think it's just ignored on non-SELinux platforms, and triggers an annoying warning on my setup (don't know if that's because of Linux or the latest Docker or docker-compose versions).

gabrielelucci avatar Apr 27 '22 16:04 gabrielelucci

FWIW, I've started seeing this warning on macOS too

browniebroke avatar Nov 22 '22 23:11 browniebroke