Awesome Docker Compose Examples
Awesome Docker Compose Examples
Docker compose example
You should have a wait start shell script instead of depending on network for the boot order.
More on reddit.comDocker-compose, two container example. Can you explain to me why this works?
I think other people have hit most of our questions directly so I'm not going to recover that ground.
Instead, I would offer a different way of thinking about your Dockerfile and Docker-Compose. Your Dockerfile dictates the setup of your container (what goes in the image), and some defaults for its behavior (things like a default CMD, or an entrypoint file).
Docker-Compose is more akin to a user-friendly interface for running complex docker container run [... options] <container_name> commands.
Instead of having to run containers commands inundated with option flags, you run them through docker-compose, and your compose file fills in the options for you. So you can do things like connect to different networks, mount volumes, send secrets, create ENV vars, etc. But none of these things influences your images themselves; at most you might override some defaults otherwise defined in you Dockerfile.
Your question about CMD is a great example. Outside of compose you could run a container from your image and Docker would use the CMD from your Dockerfile. But called through compose, you can override this setting. It's super useful for things like overriding the CMD your containers start with when developing locally. You might want to run a dev-server as your default start command with compose, but leave the image built so it defaults to a production server startup.
More on reddit.comVideos
Hi r/selfhosted,
since my last post I've cleaned my repository on GitHub with various Docker Compose examples. I've added a clean readme, issue templates and also short descriptions for each currently available compose project (aligned to the popular awesome-selfhosted repo).
I'll update the repository regularly if I come across bugs or something note-worthy. For example, if a cool project does not yet provide a docker-compose.yml or if the setup is a bit more complicated, combining various docker images with required config files etc. (like traefik or a grafana monitoring stack combining multiple images like promtail, influxdb, telegraf and so on).
Feel free to check it out if you haven't yet:
https://github.com/Haxxnet/Compose-Examples
If you have any missing compose examples that are not easily publicly available or already documented well enough by the project maintainer, feel free to issue PRs or open an issue with a request for a missing compose example. Happy to help out and extend the examples.
Cheers!