Docker Community Forums

Share and learn in the Docker community.

OSX failed to access service running in container via private ip and port of this container

(Lethe3000) #1

Expected behavior

I’m running nginx using docker-compose
PORTS NAMES 80/TCP, 443/TCP nginx
and the private ip of nginx container is
root@3f094934d933:/app/src# ip addr 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet scope host lo valid_lft forever preferred_lft forever inet6 ::1/128 scope host valid_lft forever preferred_lft forever 2: sit0@NONE: <NOARP> mtu 1480 qdisc noop state DOWN group default qlen 1 link/sit brd 3: ip6tnl0@NONE: <NOARP> mtu 1452 qdisc noop state DOWN group default qlen 1 link/tunnel6 :: brd :: 4: ip6gre0@NONE: <NOARP> mtu 1448 qdisc noop state DOWN group default qlen 1 link/gre6 00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00 brd 00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00 83: eth0@if84: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default link/ether 02:42:ac:12:00:04 brd ff:ff:ff:ff:ff:ff inet ****/16 scope global eth0 valid_lft forever preferred_lft forever inet6 fe80::42:acff:fe12:4/64 scope link valid_lft forever preferred_lft forever

I trying to access nginx by in browser, but cannot connect
on my ubuntu machine access to private ip of container is OK, so I wonder how to access this nginx service via http://private ip:80

docker info:
Containers: 3
Running: 3
Paused: 0
Stopped: 0
Images: 14
Server Version: 1.12.0-rc4
Storage Driver: aufs
Root Dir: /var/lib/docker/aufs
Backing Filesystem: extfs
Dirs: 42
Dirperm1 Supported: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Volume: local
Network: host bridge null overlay
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Security Options: seccomp
Kernel Version: 4.4.15-moby
Operating System: Alpine Linux v3.4
OSType: linux
Architecture: x86_64
CPUs: 2
Total Memory: 1.954 GiB
Name: moby
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): true
File Descriptors: 41
Goroutines: 65
System Time: 2016-07-15T08:00:21.739664956Z
EventsListeners: 1
Experimental: true
Insecure Registries:

(Lethe3000) #2

It seems the docker virtual machine issue since latest docker engine on mac does not use virtual box.