Description
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 bash
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.0.1
Output of docker info:
$ docker info
Client:
Context: default
Debug Mode: false
Plugins:
app: Docker App (Docker Inc., v0.9.1-beta3)
buildx: Build with BuildKit (Docker Inc., v0.6.3-docker)
compose: Docker Compose (Docker Inc., 2.0.0-beta.1)
scan: Docker Scan (Docker Inc., v0.8.0)
Server:
Containers: 21
Running: 13
Paused: 0
Stopped: 8
Images: 67
Server Version: 20.10.9
Storage Driver: overlay2
Backing Filesystem: extfs
Supports d_type: true
Native Overlay Diff: true
userxattr: false
Logging Driver: json-file
Cgroup Driver: cgroupfs
Cgroup Version: 1
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: 5b46e404f6b9f661a205e28d59c982d3634148f8
runc version: v1.0.2-0-g52b36a2
init version: de40ad0
Security Options:
apparmor
seccomp
Profile: default
Kernel Version: 5.13.0-7614-generic
Operating System: Pop!_OS 21.04
OSType: linux
Architecture: x86_64
CPUs: 12
Total Memory: 31.26GiB
Name: REDACTED
ID: QAXJ:HDRA:DGM3:DR75:OBYA:VOV7:EEOE:K5IG:QD57:54I7:SVH6:5EQ3
Docker Root Dir: /var/lib/docker
Debug Mode: false
Username: REDACTED
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
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