# Error response from daemon: rpc error: code = Unavailable desc = connection error: desc = "transport: Error while dialing: dial tcp: lookup tasks.manager on 127.0.0.11:53: no such host"

- **ID:** `docker/network-not-connecting-to-swarm`
- **Domain:** docker
- **Category:** network_error
- **Verification:** ai_generated
- **Fix Rate:** 76%

## Root Cause

A Docker Swarm service cannot resolve the internal DNS name 'tasks.manager' because the overlay network is not properly attached or the swarm manager node is unreachable due to DNS resolution failure.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| Docker 24.0.6 | active | — | — |
| Swarm 1.2.0 | active | — | — |
| Linux 5.15.0 | active | — | — |

## Workarounds

1. **Ensure the service is attached to an overlay network: 'docker service update --network-add my-overlay myservice'. Then verify with 'docker service ps myservice' and check DNS resolution inside the container with 'docker exec <container> nslookup tasks.manager'.** (80% success)
   ```
   Ensure the service is attached to an overlay network: 'docker service update --network-add my-overlay myservice'. Then verify with 'docker service ps myservice' and check DNS resolution inside the container with 'docker exec <container> nslookup tasks.manager'.
   ```
2. **Reinitialize the swarm on the manager node: 'docker swarm leave --force' then 'docker swarm init --advertise-addr <manager-ip>'. Rejoin worker nodes with the new token.** (75% success)
   ```
   Reinitialize the swarm on the manager node: 'docker swarm leave --force' then 'docker swarm init --advertise-addr <manager-ip>'. Rejoin worker nodes with the new token.
   ```

## Dead Ends

- **Restart the Docker daemon on all nodes** — Restarting does not fix the overlay network configuration or DNS resolver issue; the error reappears. (70% fail)
- **Manually add 'tasks.manager' to /etc/hosts inside the container** — The tasks.manager name is dynamically resolved by Swarm's internal DNS; static entries conflict with overlay network routing. (80% fail)
- **Set '--dns 8.8.8.8' in docker service create** — External DNS cannot resolve internal Swarm names like tasks.manager; this breaks service discovery. (85% fail)
