Skip to content

[Bug]: Volume fails to mount (compose) #11222

@bernhof

Description

@bernhof

Module

Core

Testcontainers version

2.0.1

Using the latest Testcontainers version?

Yes

Host OS

MacOS

Host Arch

ARM

Docker version

Client:
 Version:           28.5.2
 API version:       1.51
 Go version:        go1.25.3
 Git commit:        ecc6942
 Built:             Wed Nov  5 14:42:30 2025
 OS/Arch:           darwin/arm64
 Context:           default

Server: Docker Desktop 4.51.0 (210443)
 Engine:
  Version:          28.5.2
  API version:      1.51 (minimum version 1.24)
  Go version:       go1.25.3
  Git commit:       89c5e8f
  Built:            Wed Nov  5 14:44:06 2025
  OS/Arch:          linux/arm64
  Experimental:     false
 containerd:
  Version:          v1.7.29
  GitCommit:        442cb34bda9a6a0fed82a2ca7cade05c5c749582
 runc:
  Version:          1.3.3
  GitCommit:        v1.3.3-0-gd842d771
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

What happened?

Mounting a local volume defined in compose.yaml as:

volumes:
  - ./docker/test-client/config.json:/app/config/config.json:ro

fails with the error below.

This worked before upgrading Docker Desktop to version 4.51.0 today.

NOTE: docker compose up works just fine outside of testcontainers.

Relevant log output

[Thread-9] INFO tc.docker - Error response from daemon: failed to create task for container: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: error during container init: error mounting "/host_mnt/Users/path/to/repo/tests/docker/test-client/config.json" to rootfs at "/app/config/config.json": create mountpoint for /app/config/config.json mount: mountpoint "/run/host_virtiofs/Users/path/to/repo/test-client/dist/config/config.json" is outside of rootfs "/var/lib/docker/rootfs/overlayfs/9068713eb2a755cc3e1a0e06123bd97fb92a7c1f9064b09a41ce2a051e16771c": unknown

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions