This document compiles “lessons learned” and advice for working with Docker Compose.
- Docker Compose will export all available services in
/etc/hostswith literal container names.
- Avoid using
_in container names as this won't work universally with DNS-based service discovery
- Avoid links (they will be deprecated in future versions)
- Use cross-container networking with an overlay network
- Always build local Docker image and deploy to Sagan repository;
do not rely on 3rd party images to be available or up to date
- Use sidekick containers for bootstrapping
- No native way in
docker-composeYAML to run bootstrapping scripts (e.g. init DB); recommend sidekick containers
- No way to enforce startup delays between containers
restart: alwaysonly works when the command exits non-zero