Skip to content

[Bug]: container daemon hangs when container cp from a mounted volume #1873

Open

Description

@bittervec

I have done the following

  • I have searched the existing issues
  • If possible, I've reproduced the issue using the 'main' branch of this project

Steps to reproduce

  1. Create a named volume:
    container volume create some-vol
  2. Start a temporary container to transfer data:
    container run -d --name temp-importer -v some-vol:/target alpine tail -f /dev/null
  3. Now depending on the src/dst setup the behavior is different.

Volume as dst: copy from the host to the mounted volume

container cp /path/to/host/src temp-importer:/target

The command didn't seem to have any effects even with --debug option.

  • No output from CLI
  • No files in the /target folder of the temp container (except for lost+found)

Volume as src: copy from the mounted volume to the host

Then I did another test the other away around.

After manually creating a file with touch /target/hi in the temp container, I tried to copy from the mounted volume to the host:

container cp temp-importer:/target/hi /path/to/host/dst

The command was stuck and the daemon simply became unresponsive afterwards.

Problem description

I was initially trying to migrate some data from the host to a volume created with container, and found out container cp didn't work once a mounted volume is involved, either as source or destination.

  • no-ops when copying from the host to the mounted volume
  • container daemon hangs when copying from the mounted volume to the host

Logs

Can't locate any logs.

❯ container system logs --debug
Filtering the log data using "subsystem ==[cd] "com.apple.container""
Timestamp                       Thread     Type        Activity             PID    TTL
--------------------------------------------------------------------------------------------------------------------
Log      - Default:          0, Info:                0, Debug:             0, Error:          0, Fault:          0
Activity - Create:           0, Transition:          0, Actions:           0

Environment

- OS: macOS 26.5.1 (25F80)
- Xcode: N/A
- Container: Container CLI version 1.0.0

Code of Conduct

  • I agree to follow this project's Code of Conduct

Activity

  1. added theissue type on Jun 30, 2026
  2. Jakeshadow commented on Jul 1, 2026

    @Jakeshadow

    This is a known limitation — container cp doesn't handle Virtualization.framework's filesystem passthrough reliably for mounted volumes. Until it's fixed, the workaround is to use container exec with a direct copy command inside the container:

    container exec <container-name> cp -a /mounted/path/file /destination/
    

    For migrating data into a new container, you can also use a shared bind mount as an intermediate: mount the same host directory in both containers, then copy from within. Full migration guide covering this and other gotchas: https://maccontainer.dev/compose-alternative/

  3. magnimodi commented on Oct 13, 2026

    @magnimodi

    Additional data point: still reproducible on 1.5.0, also affects bind mounts (virtiofs), and the data silently lands in the rootfs layer underneath the mountpoint.

    Reproduced on container CLI 1.5.0 (brew), macOS 27.0.1 arm64, alpine:latest.

    container volume create v1
    container run -d --name b -v v1:/dane alpine sleep infinity
    echo HELLO > plik.txt
    container cp plik.txt b:/dane/plik.txt ; echo $?        # 0
    container exec b cat /dane/plik.txt                    # No such file or directory
    container exec b mount | grep dane                     # /dev/vdc on /dane type ext4
    container exec b sh -c 'echo X > /dane/inside.txt'
    container cp b:/dane/inside.txt ./out.txt              # Error ... notFound: copy: path not found '/dane/inside.txt'
    container stop b && container export -o b.tar b && tar tf b.tar | grep dane
    # dane/  dane/plik.txt   <- the file is in the rootfs layer under the mountpoint
    

    Same with -v /host/dir:/dane (virtiofs): cp returns 0, file absent in the container and on the host, but present in container export output.

    Control: container cp plik.txt b:/tmp/plik.txt works. tar -c plik.txt | container exec -i b tar -x -C /dane works.

    Expected: cp resolves the path as the running container sees it (through mounts), or fails with a non-zero exit code.
    Actual: exit 0 and data silently lands in the masked rootfs directory; copy out of mounted paths fails with notFound (on 1.5.0 the daemon no longer hangs).

    Log: only copyIn xpc handler [uuid=b], no error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions