Description
This ticket is a duplicate of #8766 given it was marked as "closed" but is not resolved.
Unable run to execute compose run <service> when a service is using network_mode: service:nginx
Steps to reproduce the issue:
This is a docker-compose.yml file which can replicate the issue.
version: '3'
services:
nginx:
image: nginx
cli:
image: alpine
network_mode: service:nginx
Commands which replicate the issue.
$ compose up -d
$ compose run cli sh
Error response from daemon: network service:nginx not found
Describe the results you received:
Error response from daemon: network service:nginx not found
Describe the results you expected:
The service container to execute within the same network as the "nginx" service in this case.
This worked with Compose v1.
Additional information you deem important (e.g. issue happens only occasionally):
Output of docker compose version:
Docker Compose version v2.2.2
Output of docker info:
Client:
Context: default
Debug Mode: false
Plugins:
app: Docker App (Docker Inc., v0.9.1-beta3)
buildx: Docker Buildx (Docker Inc., v0.7.1-docker)
compose: Docker Compose (Docker Inc., 2.0.0-beta.1)
scan: Docker Scan (Docker Inc., v0.12.0)
Server:
Containers: 129
Running: 1
Paused: 0
Stopped: 128
Images: 169
Server Version: 20.10.12
Storage Driver: overlay2
Backing Filesystem: extfs
Supports d_type: true
Native Overlay Diff: true
userxattr: false
Logging Driver: json-file
Cgroup Driver: systemd
Cgroup Version: 2
Plugins:
Volume: local
Network: bridge host ipvlan macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
Swarm: inactive
Runtimes: io.containerd.runc.v2 io.containerd.runtime.v1.linux runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 7b11cfaabd73bb80907dd23182b9347b4245eb5d
runc version: v1.0.2-0-g52b36a2
init version: de40ad0
Security Options:
apparmor
seccomp
Profile: default
cgroupns
Kernel Version: 5.15.5-76051505-generic
Operating System: Pop!_OS 21.10
OSType: linux
Architecture: x86_64
CPUs: 12
Total Memory: 31.32GiB
Name: batman
ID: QAXJ:HDRA:DGM3:DR75:OBYA:VOV7:EEOE:K5IG:QD57:54I7:SVH6:5EQ3
Docker Root Dir: /var/lib/docker
Debug Mode: false
Username: nickschuch
Registry: https://index.docker.io/v1/
Labels:
Experimental: false
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: false
Additional environment details:
N/A
Description
This ticket is a duplicate of #8766 given it was marked as "closed" but is not resolved.
Unable run to execute
compose run <service>when a service is usingnetwork_mode: service:nginxSteps to reproduce the issue:
This is a docker-compose.yml file which can replicate the issue.
Commands which replicate the issue.
Describe the results you received:
Describe the results you expected:
The service container to execute within the same network as the "nginx" service in this case.
This worked with Compose v1.
Additional information you deem important (e.g. issue happens only occasionally):
Output of
docker compose version:Output of
docker info:Additional environment details:
N/A