简体   繁体   中英

Azure App Service - Am I required to expose port in docker-compose

I have a node.js app that runs as a worker, so server.listen() not be used. The worker simply connects to a DB and performs some actions.

I have a docker-compose to run this however am noticing that if I dont include the ports attribute in the docker-compose the container fails to run ie:

ports:
   - 443:3000

(3000 in the above is just an example - i'm not exposing any port).

Could someone tell me why not having this causes the container to crash /what I'm mis-understanding.

(When I run the docker-compose up worker locally it runs as expected)

Thanks.

Your web server listens to a particular port. This line means you're routing web traffic from port 443 to 3000 (port your web server running inside your web app is listening to). Without this line you can't proper route web traffic to the port the web server is listening to, which causes it to fail the requests

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM