compose: `volumes_from` doesn't respect container-based volume attachment in docker-compose v2.

Description

I’m looking to attach a volume to a docker-compose service in the form of a container - which is not part of the docker-compose declaration.

Steps to reproduce the issue:

docker-compose.yaml

version: "3"

services:
  test1:
    container_name: test3
    image: alpine
    command: sleep 100000
    volumes:
      - ./testvolume:/testvolume

  test2:
    image: alpine
    volumes_from:
    - container:test3
  1. docker-compose up -d
  2. Observe the project coming up.

Describe the results you received:

no such service: test3

the volume was attempted to attach from the service test3 - not the container

Describe the results you expected:

Project should come up with the attached volume from the container named test3 (in this case it’s the test1 service.

Additional information you deem important (e.g. issue happens only occasionally):

Output of docker compose version:

Docker Compose version v2.0.0

Output of docker info:

Client:
 Context:    default
 Debug Mode: false
 Plugins:
  buildx: Build with BuildKit (Docker Inc., v0.6.3)
  compose: Docker Compose (Docker Inc., v2.0.0)
  scan: Docker Scan (Docker Inc., v0.8.0)

Server:
 Containers: 12
  Running: 11
  Paused: 0
  Stopped: 1
 Images: 15
 Server Version: 20.10.8
 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: runc io.containerd.runc.v2 io.containerd.runtime.v1.linux
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: e25210fe30a0a703442421b0f60afac609f950a3
 runc version: v1.0.1-0-g4144b63
 init version: de40ad0
 Security Options:
  seccomp
   Profile: default
 Kernel Version: 5.10.47-linuxkit
 Operating System: Docker Desktop
 OSType: linux
 Architecture: x86_64
 CPUs: 4
 Total Memory: 1.939GiB
 Name: docker-desktop
 ID: MJM6:MMLE:X3IT:JVUH:N45Q:54KE:EF26:FCUH:KW7L:WYJE:VTMF:5XBX
 Docker Root Dir: /var/lib/docker
 Debug Mode: true
  File Descriptors: 133
  Goroutines: 111
  System Time: 2021-11-03T10:42:33.974343305Z
  EventsListeners: 5
 HTTP Proxy: http.docker.internal:3128
 HTTPS Proxy: http.docker.internal:3128
 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

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 1
  • Comments: 21 (2 by maintainers)

Most upvoted comments

This is definitely still an issue.

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@deepto98 you can take a look at the BUILDING.md file. Basically you just need to do run make compose-plugin which will create a ./bin directory with a docker-compose binary

If this is still open, can I pick it up? @glours, can you point me to the files I need to look at?

Okay, thanks @glours

@deepto98 are you picking this up?

Yes, I’ll work on it this weekend (busy with some office work). Can you point me to the files I’d need to look at?

Please give v2.1.1 a try, IIRC we already fixed this