Pretix docker-compose

I'm a big fan of Docker. The documentation is excellent, and I love knowing I'm not cluttering up my filesystem when developing weirdo client projects.

I'm currently working on an Ethereum payment processor for an open-source ticketing software. It's a django project, and quite complex. It comes with a Dockerfile, but I couldn't find a docker-compose setup for osx development. I took the opportunity to learn some of the in's and out's of docker-compose version 3.

In a nutshell not much has changed other than the way volumes are mounted. Seems to me like many people are still using version 2 just because of this.

If your goal is a simple development setup, you likely want to be able to monitor your logs and mount your data volumes. Both these requires giving yourself host access to directories within a running container.

The trick is to use local named volumes.

version: '3' services:
pretix: image: pretix/standalone:stable ports: - "8000:80" volumes: - data:/data - src:/pretix/src

Specify a "local" driver, and pass through the 'bind' option to the linux "mount" command. It took a bit of digging to understand that docker is simply using "mount" for it's local driver.

volumes: data: driver: local driver_opts: type: 'none' o: 'bind' device: ${PWD}/rootfs/data src: driver: local driver_opts: type: 'none' o: 'bind' device: ${PWD}/rootfs/src

This enables local filesystem access to volumes used in your containers. The docker storage docs were really helpful in clarifying the different types of storage mounts, and the mount man pages are helpful in understanding the individual options being passed through. Here's a few other blogs that helped provide context along the way:

And here's a link to the repo, in case you're looking to a docker-compose setup for Pretix: https://github.com/codydjango/pretix-docker-compose