So I have 2 services running - my website and the API.
In my code for the website I specified that it should use the API that has port
equal to API_PORT
env var.
My question: is there a way to set the API_PORT
variables based on the ports from api service?
Overview of my docker-compose.yml
:
api-service:
...otherconfig
ports:
- 8009:8009
website:
...
Just inject the API_PORT
env var into your compose file too:
export API_PORT=8009
then in the compose file
api-service:
...otherconfig
ports:
- ${API_PORT}:${API_PORT}
website:
...
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.