我正在使用Docker Desktop for Mac并在我的主机上运行一个容器。我可以通过主机上的 localhost 访问容器。但它不能从局域网上的其他系统获得。
该容器是nginx web server,可以localhost:80
在同一 LAN 网络上的其他系统上访问,但不能从其他系统访问。
我希望其他系统能够访问主机上的容器。
编辑 1:添加 docker-compose 配置和“docker info”命令输出
version: '2'
services:
nginx:
image: artifactory.service.dev:5000/nginx:latest
network_mode: host
ports:
- "80:80"
- "10001-10020:10001-10020"
- "8080:8080"
volumes:
- ~/docker/.docker/nginx/html:/usr/share/nginx/html
redis:
image: artifactory.service.dev:5000/redis:latest
restart: always
ports:
- "6379:6379"
activemq:
image: artifactory.service.dev:5000/rmohr/activemq:5.11.1
restart: always
ports:
- "61613:61613"
- "61616:61616"
- "8161:8161"
oracle:
image: artifactory.service.dev:5000/oracle-12c:latest
restart: always
ports:
- "1521:1521"
volumes:
- ~/docker/.docker/oracle:/tmp/oracle:ro
privileged: true
码头工人信息
Containers: 4
Running: 3
Paused: 0
Stopped: 1
Images: 38
Server Version: 1.12.1
Storage Driver: aufs
Root Dir: /var/lib/docker/aufs
Backing Filesystem: extfs
Dirs: 310
Dirperm1 Supported: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
Volume: local
Network: host bridge null overlay
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Security Options: seccomp
Kernel Version: 4.4.19-moby
Operating System: Alpine Linux v3.4
OSType: linux
Architecture: x86_64
CPUs: 6
Total Memory: 11.71 GiB
Name: moby
ID: LBLG:7UQC:W67Q:J744:QAHE:4JLX:QRVB:2QQD:PTB2:MV75:HD6Y:FROD
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): true
File Descriptors: 50
Goroutines: 72
System Time: 2016-09-01T06:51:40.063477725Z
EventsListeners: 1
No Proxy: *.local, 169.254/16, *.dev
Registry: https://index.docker.io/v1/
Experimental: true
Insecure Registries:
artifactory.service.dev:5000
127.0.0.0/8
用于启动容器的命令:
docker-compose up -d nginx