Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

[BUG] "bind source path does not exist" on v2.24.0 #11345

Closed
pjsmith404 opened this issue Jan 15, 2024 · 6 comments · Fixed by compose-spec/compose-go#525 or #12208
Closed

[BUG] "bind source path does not exist" on v2.24.0 #11345

pjsmith404 opened this issue Jan 15, 2024 · 6 comments · Fixed by compose-spec/compose-go#525 or #12208

Comments

@pjsmith404
Copy link

Description

Hello,

On version 2.24.0 of docker compose, I get the following bind error when trying to run docker compose up, if the source directory does not already exist:

Error response from daemon: invalid mount config for type "bind": bind source path does not exist: /tmp/logs

I expect that if the source directory does not exist, it should be automatically created. If I revert back to version 2.23.3, the error does not occur and the directory is created automatically as expected.

I didn't see anything in the change logs that indicated an expected change to this behaviour. Apologies if I overlooked something.

Cheers,

Pat

Steps To Reproduce

  1. Create a compose file located at /tmp/test.yml with the following content:
services:
  test:
    image: alpine
    volumes:
      - ./logs/:/tmp/logs/
    command: ls /tmp/logs/
  1. Run docker compose --file /tmp/test.yml up
  2. You should see the error Error response from daemon: invalid mount config for type "bind": bind source path does not exist: /tmp/logs
  3. Create the folder /tmp/logs/
  4. Run docker compose --file /tmp/test.yml up.
  5. The container should launch as expected.

Compose Version

Docker Compose version v2.24.0

Docker Environment

Client:
 Context:    default
 Debug Mode: false
 Plugins:
  buildx: Docker Buildx (Docker Inc., v0.11.2)
  compose: Docker Compose (Docker Inc., v2.24.0)

Server:
 Containers: 0
  Running: 0
  Paused: 0
  Stopped: 0
 Images: 0
 Server Version: 20.10.25
 Storage Driver: overlay2
  Backing Filesystem: xfs
  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: 0cae528dd6cb557f7201036e9f43420650207b58
 runc version: f19387a6bec4944c770f7668ab51c4348d9c2f38
 init version: de40ad0
 Security Options:
  seccomp
   Profile: default
 Kernel Version: 4.14.334-252.552.amzn2.x86_64
 Operating System: Amazon Linux 2
 OSType: linux
 Architecture: x86_64
 CPUs: 8
 Total Memory: 31.4GiB
 Name: ip-172-20-90-60.ap-southeast-2.compute.internal
 ID: ZHVR:BPLX:AZJW:A7YR:4F3Q:O77D:KZJ6:ZMFS:T4WU:6AXS:45ZS:QGMM
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 Registry: https://index.docker.io/v1/
 Labels:
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false

Anything else?

No response

@kinkerl
Copy link

kinkerl commented Jan 15, 2024

We run into this problem as well. It is fine on 2.23.3

@derlin
Copy link

derlin commented Jan 17, 2024

Possible to update docker:latest image with this fix? It is quite blocking.

@ndeloof
Copy link
Contributor

ndeloof commented Jan 17, 2024

@derlin a bug-fix release is planned later this week

@snyh
Copy link

snyh commented Oct 12, 2024

the bug is still exist on v2.29.7

@ndeloof
Copy link
Contributor

ndeloof commented Oct 12, 2024

@snyh can't reproduce

>tmp docker compose -f test.yaml up
[+] Running 2/0
 ✔ Network tmp_default   Created                                           0.0s 
 ✔ Container tmp-test-1  Created                                           0.0s 
Attaching to test-1
test-1 exited with code 0

@snyh
Copy link

snyh commented Oct 13, 2024

Oh, I know the reason.

I used the long syntax of bind mount. In this case, the target will not be cleaned up.

[snyh@yoga-x1 cmd]$ cat bad.yml 
name: test_bind_long_syntax
services:
  test:
    image: alpine
    volumes:
      - type: bind
        source: /tmp/test-long_syntax_logs
        target: /tmp/logs/
        bind:
          create_host_path: true
[snyh@yoga-x1 cmd]$ ./cmd -f bad.yml create
[+] Creating 0/0
 ⠋ Container test_bind_long_syntax-test-1  Creating                                                                                                                      0.0s 
Error response from daemon: invalid mount config for type "bind": bind source path does not exist: /tmp/test-long_syntax_logs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
6 participants