Docker swarm on AWS – swarm services cannot access internet

I’ve create a docker swarm (Docker version 17.03.1-ce) of one manager and 2 workers. All swarm nodes can “ping” but inside the swarm service containers I can “ping” and not “ping”, they can not resolve the domain name.

on the manager I have in /usr/sbin/dhclient-script

  • Add host mapping to /etc/hosts in Kubernetes
  • AWS ECR image list
  • cannot connect to service hosted in ECS built through cloudformation template
  • AWS ECS running a task that requires many cores
  • Multi Docker container with PHP7 fpm and nginx
  • Adding portMappings to with Single container configuartion
  • search eu-central-1.compute.internal

    and on one of the containers I have in /usr/sbin/dhclient-script

    search eu-central-1.compute.internal
    options ndots:0

    Docker networks:

    $ docker network ls
    NETWORK ID          NAME                DRIVER              SCOPE
    ID                  bridge              bridge              local
    ID                  docker_gwbridge     bridge              local
    ID                  host                host                local
    ID                  ingress             overlay             swarm
    ID                  my_overlay          overlay             swarm
    ID                  none                null                local

    I start the docker service this way:

    docker service create \
        --name myservice \
        --replicas 1 \
        --endpoint-mode dnsrr \
        --network my_overlay \
        --constraint 'node.role == manager' \
        --env COOKIE='SRV insert indirect nocache maxidle 30m maxlife 8h' \
        --env VIRTUAL_HOST='myservice' \
        --env SERVICE_PORTS='8080' \

    AWS VPC and security groups are configured correctly I think, since ec2 instances can reach external domain names, and can be reached externally too.
    Why can’t myservice resolve for example

  • minikube : not able to connect a locally deployed nginx service
  • How do I attach multiple containers directly to a physical interface?
  • Docker swarm use local service instance
  • Container cannot be started from
  • Docker : Sharing a volume on Windows with Docker toolbox
  • Add development or debugging tools layer to existing docker containers
  • One Solution collect form web for “Docker swarm on AWS – swarm services cannot access internet”

    It seems that the problem is solved.

    I habe to add "dns": ["",""] to /etc/docker/daemon.json.

    I tried to do the same in /etc/default/docker, it didn’t work, I guess that’s the old way.

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.