# podman cp: Copy Files To and From Containers

> podman cp copies files between a container and the host. Reference for the source:dest syntax, directories, and the path and permission errors in CI.

Source: https://latchkey.dev/learn/command-reference/podman-cp  
Updated: 2026-06-30

podman cp copies files and directories between a container filesystem and the host, in either direction.

Use podman cp to pull build artifacts or test reports out of a container, or to push a config in. It works whether the container is running or stopped.

## What it does

podman cp copies between CONTAINER:PATH and a host path. The direction is set by which side has the container prefix. It handles single files and whole directories and works on stopped containers too.

## Common usage

```Terminal
# container -> host
podman cp app:/app/coverage ./coverage
# host -> container
podman cp ./config.yml app:/etc/app/config.yml
# copy out a single report file
podman cp tests:/results/junit.xml ./junit.xml
```

## Options

| Argument/Flag | What it does |
| --- | --- |
| <container>:<path> | Container side of the copy (source or dest) |
| <host path> | Host side of the copy |
| -a, --archive | Preserve ownership and mode where possible |
| --overwrite | Allow overwriting a file with a directory or vice versa |

## In CI

podman cp is the simplest way to extract JUnit/coverage reports from a test container after the run so the CI step can publish them. It does not need the container running, so copy after the container exits and before podman rm.

## Common errors in CI

"Error: no such file or directory" means the in-container path is wrong; check it with podman exec ... ls. "Error: no such container" means the container was already removed; copy before teardown. On rootless Podman, files copied out are owned by your mapped UID, so a later step running as a different user may hit "Permission denied"; use -a or fix ownership.

## FAQ

### podman cp: Copy Files To and From Containers?

Use podman cp to pull build artifacts or test reports out of a container, or to push a config in. It works whether the container is running or stopped.

### What it does?

podman cp copies between CONTAINER:PATH and a host path. The direction is set by which side has the container prefix. It handles single files and whole directories and works on stopped containers too.

### In CI?

podman cp is the simplest way to extract JUnit/coverage reports from a test container after the run so the CI step can publish them. It does not need the container running, so copy after the container exits and before podman rm.

### Common errors in CI?

"Error: no such file or directory" means the in-container path is wrong; check it with podman exec ... ls. "Error: no such container" means the container was already removed; copy before teardown.

---

Latchkey runs CI/CD that repairs its own failures. Agent entry points: https://latchkey.dev/agent.txt, https://latchkey.dev/openapi.json, https://latchkey.dev/llms.txt
