我無法通過docker-compose容器訪問外部網絡。docker-compose服務器內部沒有互聯網
考慮以下泊塢窗,撰寫文件:
version: '2'
services:
nginx:
image: nginx
使用簡單docker run -it nginx bash
我設法到達外部IP地址或IP地址上網(ping www.google.com
)。
另一方面,如果我使用docker-compose並將其附加到容器,我無法訪問外部IP地址/ DNS。
泊塢窗信息:
Containers: 0
Running: 0
Paused: 0
Stopped: 0
Images: 1
Server Version: 1.12.1
Storage Driver: aufs
Root Dir: /var/lib/docker/aufs
Backing Filesystem: extfs
Dirs: 7
Dirperm1 Supported: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
Volume: local
Network: bridge null host overlay
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Security Options: apparmor seccomp
Kernel Version: 4.4.0-38-generic
Operating System: Ubuntu 16.04.1 LTS
OSType: linux
Architecture: x86_64
CPUs: 2
Total Memory: 3.859 GiB
Name: ***
ID: ****
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
WARNING: No swap limit support
WARNING: bridge-nf-call-iptables is disabled
WARNING: bridge-nf-call-ip6tables is disabled
Insecure Registries:
127.0.0.0/8
泊塢窗,撰寫1.8.1,建立878cff1
daemon.json文件:
{
"iptables" : false,
"dns" : ["8.8.8.8","8.8.4.4"]
}
您是否使用docker exec -it ping google.com'? 這應該工作。 –
Alkaline
這正是我所做的 –
你看過網絡嗎?什麼是_docker網絡檢查bridge_顯示?假設'橋'是默認網絡。 – aholbreich