docker / for-linux

Docker Engine for Linux
https://docs.docker.com/engine/installation/
756 stars 85 forks source link

Cannot attach to container on one swarm host from another swarm host #276

Open mfavetti opened 6 years ago

mfavetti commented 6 years ago

Expected behavior

Should be able to attach to container alpine2 running on host2 from host1 e.g: (host1) $ docker container attach alpine2

Actual behavior

Error: No such container alpine2

Steps to reproduce the behavior

Following instructions on https://docs.docker.com/network/network-tutorial-overlay/#use-an-overlay-network-for-standalone-containers using two freshly spun up VMs running ubuntu server 16.04 and docker 18.03.0-ce.

Step 5 fails to attach to the container. Attaching to alpine1 on host1 works and so does a ping to alpine2 from alpine1 (and vice-versa). But I cannot attach to alpine2 from host1 or alpine1 from host2.

The network gets created on host2. However, a network inspect test-net on each host only shows the container running on that host (ie. host1 only shows alpine1 and host2 only shows alpine2).

I first experienced this issue when trying to setup container communication across two docker hosts using overlay networking. Figured there must be something wrong with my environment, so I setup the simplest example I could with two virtual machines and following only the instructions on the tutorial from the documentation and the issue persists.

Output of docker version:

Client:
 Version:   18.03.0-ce
 API version:   1.37
 Go version:    go1.9.4
 Git commit:    0520e24
 Built: Wed Mar 21 23:10:01 2018
 OS/Arch:   linux/amd64
 Experimental:  false
 Orchestrator:  swarm

Server:
 Engine:
  Version:  18.03.0-ce
  API version:  1.37 (minimum version 1.12)
  Go version:   go1.9.4
  Git commit:   0520e24
  Built:    Wed Mar 21 23:08:31 2018
  OS/Arch:  linux/amd64
  Experimental: false

Output of docker info:

Containers: 1
 Running: 0
 Paused: 0
 Stopped: 1
Images: 2
Server Version: 18.03.0-ce
Storage Driver: overlay2
 Backing Filesystem: extfs
 Supports d_type: true
 Native Overlay Diff: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
 Volume: local
 Network: bridge host macvlan null overlay
 Log: awslogs fluentd gcplogs gelf journald json-file logentries splunk syslog
Swarm: active
 NodeID: xboovf6yz485klkqppsjwsi4j
 Is Manager: true
 ClusterID: 3imbyw6952uwkgpk32m83et2t
 Managers: 1
 Nodes: 2
 Orchestration:
  Task History Retention Limit: 5
 Raft:
  Snapshot Interval: 10000
  Number of Old Snapshots to Retain: 0
  Heartbeat Tick: 1
  Election Tick: 3
 Dispatcher:
  Heartbeat Period: 5 seconds
 CA Configuration:
  Expiry Duration: 3 months
  Force Rotate: 0
 Autolock Managers: false
 Root Rotation In Progress: false
 Node Address: 10.0.2.4
 Manager Addresses:
  10.0.2.4:2377
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: cfd04396dc68220d1cecbe686a6cc3aa5ce3667c
runc version: 4fc53a81fb7c994640722ac585fa9ca548971871
init version: 949e6fa
Security Options:
 apparmor
 seccomp
  Profile: default
Kernel Version: 4.4.0-119-generic
Operating System: Ubuntu 16.04.4 LTS
OSType: linux
Architecture: x86_64
CPUs: 1
Total Memory: 992.2MiB
Name: host1
ID: Q3F7:XSV5:P3TM:WA7Z:DOYE:4ZDN:RSGZ:F3PC:QICE:XEJT:ZGXW:GAHE
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
Labels:
Experimental: false
Insecure Registries:
 127.0.0.0/8
Live Restore Enabled: false

Additional environment details (AWS, VirtualBox, physical, etc.) VirtualBox

cpuguy83 commented 6 years ago

Thanks, this is a documentation bug. Container commands are local to the node.