How to fetch files from an exited container ?
Environment
- RHEL
- podman
Resolution
execoperation can not be performed on an exited container- One can use
podman cpto access the files from inside of an exited container
podman cp <container-name>:/path-to-file <destination-path-on-host>
Root Cause
- Once container is exited, it can not be accessed using
exec(unless started again) and the only way the files inside the container can be accessed from an exited container is by copying the file from inside the container to the host usingpodman cp
Diagnostic Steps
- When you try to run an
execoperation in an exited container,
# podman exec -it 666f4dd0f51f cat /tmp/file
Error: can only create exec sessions on running containers: container state improper
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.
Comments