You’ll almost certainly want to make changes to your app configuration that are more appropriate to a live environment. These changes may include:
- Removing any volume bindings for application code, so that code stays inside the container and can’t be changed from outside
- Binding to different ports on the host
- Setting environment variables differently (e.g., to decrease the verbosity of logging, or to enable email sending)
- Specifying a restart policy (e.g., restart: always) to avoid downtime
- Adding extra services (e.g., a log aggregator)
For this reason, you’ll probably want to define an additional Compose file, say production.yml
, which specifies production-appropriate configuration. This configuration file only needs to include the changes you’d like to make from the original Compose file.
docker-compose -f docker-com