Docker Community Forums

Share and learn in the Docker community.

Docker container contact/communicate outside container/host

docker
beta

(Thalesfsp) #1

Expected behaviour

curl -XGET 0.0.0.0:3001 from inside of the container against the host should return {status: 200} where in the 3001 port, is running an very basic ExpressJS web app.

Actual behaviour

root@e19fc8e02595:/# curl localhost:3001
curl: (7) Failed to connect to localhost port 3001: Connection refused

root@e19fc8e02595:/# curl 0.0.0.0:3001
curl: (7) Failed to connect to 0.0.0.0 port 3001: Connection refused

root@e19fc8e02595:/# curl 172.25.8.25:3001
{"status":200} 
root@e19fc8e02595:/#

Where 172.25.8.25 works and it is my WiFi IP. How can I solve it?

Thanks!

Information

$pinata diagnose -u
OS X: version 10.11.5 (build: 15F34)
Docker.app: version: v1.11.1-beta14.5.m
Running diagnostic tests:
[OK]      docker-cli
[OK]      Moby booted
[OK]      driver.amd64-linux
[OK]      vmnetd
[OK]      osxfs
[OK]      db
[OK]      slirp
[OK]      menubar
[OK]      environment
[OK]      Docker
[OK]      VT-x
Docker logs are being collected into /tmp/20160608-134830.tar.gz
Most specific failure is: No error was detected
Your unique id is: BA903F3F-80DB-4589-AA4E-41B4BE3F3F3B
Please quote this in all correspondence.

Mac OS X

Steps to reproduce the behaviour

  1. Run the ExpressJS NodeJS in the host
  2. Run any Ubuntu image and curl from inside trying to reach outside

Docker for Mac beta 9 and daemon options
(David Maze) #2

That never works…nothing ever has the IPv4 address 0.0.0.0.

Yup, that’s the recipe: find the host IP address and use that. It’s the same for Docker on Linux.