Docker: listening in container, not answering outside

I have a docker container built with “EXPOSE 8000” among its instructions. I started the process like this:

sudo docker run -t -i -P imagename

The process in the container is listening on 8000.

  • Check for network error in cf ic login in Bluemix
  • How to set up two Nginx containers as a reverse proxy in an active-passive set up with failover?
  • How to build docker images with volumes for production
  • Container Orchestration for provisioning single containers based on user action
  • Manage docker environment for Swarm running cluster with UPC
  • Docker diff images
  • # netstat -a
    Active Internet connections (servers and established)
    Proto Recv-Q Send-Q Local Address           Foreign Address         State      
    tcp        0      0 localhost:8000          *:*                     LISTEN     
    Active UNIX domain sockets (servers and established)
    Proto RefCnt Flags       Type       State         I-Node   Path

    On the host (i.e., outside the container), I see that port 49164 is bound to container port 8000:

    [S-22]jeff@siegfried:~ $ sudo docker ps 
    CONTAINER ID        IMAGE                      COMMAND             CREATED             STATUS              PORTS                     NAMES
    0b0e333c6ec9        lkz:latest                 "/bin/bash"         About an hour ago   Up 6 minutes>8000/tcp   lkxyz__2015-01-18_202737   
    [S-22]jeff@siegfried:~ $ 

    Inded, docker inspect says (among other things)

    "NetworkSettings": {
        "Bridge": "docker0",
        "Gateway": "",
        "IPAddress": "",
        "IPPrefixLen": 16,
        "PortMapping": null,
        "Ports": {
            "8000/tcp": [
                    "HostIp": "",
                    "HostPort": "49164"

    And yet, I can’t talk to the container. Outside,

    [S-22]jeff@siegfried:~ $ telnet localhost 49164
    Connected to localhost.
    Escape character is '^]'.
    Connection closed by foreign host.
    1,[S-22] jeff@siegfried:~ $ 

    while inside,

    # telnet localhost 8000
    Trying ::1...
    Connected to localhost.
    Escape character is '^]'.
    GET /
    [18/Jan/2015 23:00:59] "GET /" 200 4066
    <!DOCTYPE html>

    I would expect the telnet to 49164 on the outside to return html as it does on the inside.

    Any suggestions?

  • docker-compose creating multiple instances for the same image
  • Unable to execute Postgresql commands with python in seperate docker containers
  • docker run -it bash -c 'Function from sourced file'
  • docker-compose service and the network
  • How to push into gitlab again when the docker-volume or the server data is recreated?
  • How to set image stored path in docker registry?
  • One Solution collect form web for “Docker: listening in container, not answering outside”

    You probably want to have the service you’re running in the container to listen on rather than

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