curl Flask web service inside Docker container

I’ve got a Flask web service running in a Docker container on port 5000. How do I curl this service from inside the container? I can curl it from outside, i.e. the host, using curl http://localhost:5000/<path>.

  • Installing mongoimport in a docker image
  • Docker ADD vs VOLUME
  • Why does uWSGI fail to start in Docker?
  • boot2docker fails to start on windows 7
  • getting python and react component based container to work
  • What are the differences between dockerfile and stackbrew users on docker hub
  • Looking for a convenient way to start and stop applications with docker-compose
  • Changes to css, js, and static files not reflected on nginx docker container
  • can docker registry proxy support multiple remoteurl?
  • Cannot connect from python to influxdb when running in docker
  • Best way to transfer data to named volume of Docker
  • Unresponsive SonarQube in Kubernetes
  • One Solution collect form web for “curl Flask web service inside Docker container”


    sudo docker inspect --format='{{json .NetworkSettings.Ports}}' <containername or container id>

    In the network section look at ports.

      "443/tcp": [
          "HostIp": "",
          "HostPort": "8443"
      "80/tcp": [
          "HostIp": "",
          "HostPort": "8080"

    As you can see my container is listening on port 80 and 443 so if I use curl inside the container I should use these ports. On the other hand from the docker host I should use HostPorts.

    Alternatively you can look at the Dockerfile to view which ports are exposed.

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.