1

I'm using docker on ubuntu.

cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=14.04
DISTRIB_CODENAME=trusty
DISTRIB_DESCRIPTION="Ubuntu 14.04.3 LTS"

I have this container:

CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS                  NAMES
2b20d2dc367c        erocci/erocci       "/root/run.sh"      11 minutes ago      Up 11 minutes       0.0.0.0:8080->80/tcp   erocci

So, docker map the exposed port 80 from the container to 8080 in our host. In my machine, the port 8080 is listening.

sudo netstat -an | grep -E "8080"
tcp6       0      0 :::8080                 :::*                    LISTEN

The docker-machine is running on:

docker-machine ls
NAME       ACTIVE   DRIVER       STATE     URL                         SWARM
OCCIware   -        virtualbox   Running   tcp://<IP>:2376

However, when I run

curl http://<IP>:8080/-/

I got this error:

curl: (7) Failed to connect to <IP> port 8080

The version of docker is

docker version
Client:
 Version:      1.9.0
 API version:  1.21
 Go version:   go1.4.2
 Git commit:   76d6bc9
 Built:        Tue Nov  3 17:43:42 UTC 2015
 OS/Arch:      linux/amd64

Server:
 Version:      1.9.0
 API version:  1.21
 Go version:   go1.4.2
 Git commit:   76d6bc9
 Built:        Tue Nov  3 17:43:42 UTC 2015
 OS/Arch:      linux/amd64

and the curl version is :

curl --version
curl 7.35.0 (x86_64-pc-linux-gnu) libcurl/7.35.0 OpenSSL/1.0.1f zlib/1.2.8 libidn/1.28 librtmp/2.3

My question is: how can i run curl http://<IP>:8080/-/ properly ?

5
  • Where's the evidence that anything is actually listening on port 80 in the container?
    – womble
    Nov 10, 2015 at 11:40
  • @womble how can i verify if port 80 in the container listening ?
    – user15992
    Nov 10, 2015 at 12:13
  • netstat -ltnp inside the container would be one possible way. An lsof of all processes running the container's cgroup would be another.
    – womble
    Nov 10, 2015 at 12:14
  • @womble inside a container: root@2b20d2dc367c:/# netstat -ltnp bash: netstat: command not found
    – user15992
    Nov 10, 2015 at 12:22
  • And this is why running stripped-down micro-OSes in containers isn't such a winning strategy... Hence why I suggested the lsof method as well.
    – womble
    Nov 10, 2015 at 22:15

0

You must log in to answer this question.

Browse other questions tagged .