containers / containers/podman-compose

Service volume option nocopy is ignored

Open
#1,459 1 comment 0 reactions 0 assignees View on GitHub
bug
Dominant language
Python
Stars
6.2k
Forks
622
PR merge metrics
No merged PRs in 30d

Description

**Describe the bug**
The dockerfile specification provides a `nocopy` option to volume mounts which disables copying files and directories already present at the mountpoint into the volume.

podman-compose does not seem to implement this functionality, semi-confirmed by a code search for "nocopy" in this repository not turning up any results.

The following Dockerfile:
**To Reproduce**

The following Dockerfile:
```
FROM alpine
RUN mkdir /data; touch /data/a
CMD ls /data/
```

and docker-compose.yml:
```
services:
present:
build: .
absent:
build: .
volumes:
- type: volume
target: /data/
volume:
nocopy: true
```

Running `podman compose up` should result in `present` listing a directory with file `a` and `absent` listing an empty directory. However, both list a directory containing the file `a`. Listing the files in the volume using a command such as `podman run -it --rm -v $VOLUME_ID:/vol busybox ls -lha /vol` confirms this.

The `nocopy` option is properly supported by podman itself, as seen in the documentation: https://docs.podman.io/en/latest/markdown/podman-run.1.html#volume-v-source-volume-host-dir-container-dir-options and verified by me. However, the default is `copy`.

**Environment:**
- OS: Linux
- podman version: 5.8.2
- podman compose version: 1.5.0

**Additional context:**
Interestingly, I encountered the same issue when using `docker-compose` as a compose backend with Podman, so `docker-compose` may not implement this correctly either? Or maybe there's an incompatibility between Docker and Podman there. However, to be clear, I *did* verify this issue with `podman-compose` as the compose backend.

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the issue with the provided Dockerfile and docker-compose.yml using podman compose up, then trace how the volume definition is translated into the Podman command. Compare the generated mount options with Podman’s nocopy documentation. Done means the present service lists a, while the absent service lists an empty directory.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker-compose, python
Domain
devops
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
50/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.