Reputation: 3834
I want docker-compose to:
.env
file.env
fileI've tried this but it always exposes a random port.
ports:
- 80
I've tried this but it always exposes on 80 when there is no value in env.
ports:
- ${PORT:-80}
What I like to achieve could be something like this:
ports:
- ${PORT:-RANDOM}
Upvotes: 0
Views: 353
Reputation: 443
Setting the default to 0 will cause the operating system to assign a random port.
For example:
ports:
- ${APP_PORT:-0}:80
Upvotes: 1