Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Failure to create multiple containers using the same volumes #12305

Open
tonynajjar opened this issue Nov 19, 2024 · 4 comments
Open

Failure to create multiple containers using the same volumes #12305

tonynajjar opened this issue Nov 19, 2024 · 4 comments
Labels

Comments

@tonynajjar
Copy link

Description

Everything needed is in Steps to reproduce. I expect to have no error

Steps To Reproduce

  1. with this docker compose file:
services:
  container1:
    image:  ubuntu:22.04
    container_name: container1
    volumes:
    # Purely random volumes for demonstration purposes.
      - volume1:/etc/systemd/system
      - volume2:/etc/systemd/user
      - volume3:/etc/security
      - volume4:/etc/skel
    command: sleep infinity

  container2:
    extends: container1
    container_name: container2

  container3:
    extends: container1
    container_name: container3

  container4:
    extends: container1
    container_name: container4

  container5:
    extends: container1
    container_name: container5

volumes:
  volume1:
  volume2:
  volume3:
  volume4:
  1. run docker compose down -v && docker compose up --no-start enough times, e.g. 10
  2. You get the error Error response from daemon: failed to mkdir /var/lib/docker/volumes/desktop_volume3/<some_file>: mkdir /var/lib/docker/volumes/desktop_volume3/<some_file>: file exists

Compose Version

Docker Compose version v2.29.7

Docker Environment

Client: Docker Engine - Community
 Version:    27.3.1
 Context:    default
 Debug Mode: false
 Plugins:
  buildx: Docker Buildx (Docker Inc.)
    Version:  v0.17.1
    Path:     /usr/libexec/docker/cli-plugins/docker-buildx
  compose: Docker Compose (Docker Inc.)
    Version:  v2.29.7
    Path:     /usr/libexec/docker/cli-plugins/docker-compose

Server:
 Containers: 4
  Running: 0
  Paused: 0
  Stopped: 4
 Images: 6
 Server Version: 27.3.1
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Using metacopy: false
  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 splunk syslog
 Swarm: inactive
 Runtimes: io.containerd.runc.v2 nvidia runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 7f7fdf5fed64eb6a7caf99b3e12efcf9d60e311c
 runc version: v1.1.14-0-g2c9f560
 init version: de40ad0
 Security Options:
  apparmor
  seccomp
   Profile: builtin
  cgroupns
 Kernel Version: 6.8.0-48-generic
 Operating System: Ubuntu 24.04.1 LTS
 OSType: linux
 Architecture: x86_64
 CPUs: 16
 Total Memory: 14.92GiB
 Name: tony-XMG-CORE-M24
 ID: 50c1e9d0-566c-41f0-aaad-6a08a8e3a281
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false

WARNING: bridge-nf-call-iptables is disabled
WARNING: bridge-nf-call-ip6tables is disabled

Anything else?

No response

@idsulik
Copy link
Collaborator

idsulik commented Nov 19, 2024

Couldn't reproduce it

docker compose version
Docker Compose version v2.29.7-desktop.1


docker compose up -d    
[+] Running 5/5
 ✔ Container container4  Started                                                                                                                                                                                                0.1s 
 ✔ Container container1  Started                                                                                                                                                                                                0.1s 
 ✔ Container container5  Started                                                                                                                                                                                                0.1s 
 ✔ Container container3  Started                                                                                                                                                                                                0.1s 
 ✔ Container container2  Started

@tonynajjar
Copy link
Author

tonynajjar commented Nov 19, 2024

run docker compose down -v && docker compose up --no-start enough times, e.g. 10

@idsulik how many times did you try?

@idsulik
Copy link
Collaborator

idsulik commented Nov 19, 2024

run docker compose down -v && docker compose up --no-start enough times, e.g. 10

@idsulik how many times did you try?

about 20 times

@ndeloof
Copy link
Contributor

ndeloof commented Nov 20, 2024

Sounds like a race condition in docker engine, unrelated to Docker Compose - I assume you could reproduce this error with a bunch of docker run -v .. commands. Can you give it a try ?

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants