no internet inside docker-compose service : <p><strong>I cannot reach external network from docker-compose containers.</strong></p>

<p>Consider the following docker-compose file:</p>

<pre><code>version: '2'
services:
    nginx:
      image: nginx
</code></pre>

<p>Using the simple <code>docker run -it nginx bash</code> I manage to reach external IPs or Internet IPs (<code>ping www.google.com</code>). </p>

<p>On the other hand if I use docker-compose and attach to the container, I cannot reach external IP addresses / DNS.</p>

<p>docker info:</p>

<pre><code>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
</code></pre>

<p>docker-compose 1.8.1, build 878cff1</p>

<p>daemon.json file:</p>

<pre><code>{
  "iptables" : false,
  "dns" : ["8.8.8.8","8.8.4.4"]
}
</code></pre>
