How to get the port numbers for a service - Docker compose file

前端 未结 2 1288
被撕碎了的回忆
被撕碎了的回忆 2021-01-26 08:45

I am trying to start containers with the docker-compose.yml. I am trying to start two services, one is mongo and other is OHIF viewer.

相关标签:
2条回答
  • 2021-01-26 08:55

    Did you use docker-compose run or docker-compose up?

    According to docker documentation: "docker-compose run command does not create any of the ports specified in the service configuration."

    Try to use docker-compose up command.

    0 讨论(0)
  • 2021-01-26 09:03

    If you use network_mode: host it bypasses all of Docker's standard networking. In this case that includes the port mappings: since the container is directly using the host's network interface, there's nothing to map per se.

    network_mode: host is almost never necessary and I'd remove it here. That should make the ports visible in the docker ps output again, and make the remapped port 3030 accessible. As it is you can probably reach your service on port 80, which presumably the service binds to, directly on the host network.

    0 讨论(0)
提交回复
热议问题