Docker Community Forums

Share and learn in the Docker community.

Docker container contact/communicate outside container/host


(Thalesfsp) #1

Expected behaviour

curl -XGET 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
curl: (7) Failed to connect to port 3001: Connection refused

root@e19fc8e02595:/# curl

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



$pinata diagnose -u
OS X: version 10.11.5 (build: 15F34) 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

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