linux docker局域网访问,如何从局域网上的另一台机器访问Docker容器

我正在使用适用于Mac的Docker Desktop,并在主机上运行容器.我可以通过主机上的localhost访问容器.但是它不能从局域网上的其他系统获得.

容器是nginx Web服务器,可以在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

docker info

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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值