How to podman cp on Windows
After frustrating couple hours of figuring out how to podman cp on Windows, I am leaving a summary of the process for those struggling as well.
I was trying to start a podman container from mysql:5.7 image, and then podman cp an sql dump file to that container. But there's a bug in podman where the Windows path colon is recognized as a separator.
Sanity check: If you have existing podman machine, create a new default podman machine (in Podman Desktop, don't change anything when creating new machine) first and delete the existing one.
Start the podman container. When I was running container from mysql:5.7 image, I set an environment variable MYSQL_ROOT_PASSWORD as well.
On Windows, check the path of the file you want to send by typing
wsl
on Terminal. After accessing wsl, you can find the path to file bypwd
. Remember this path to the file!You can transfer the file by
wsl -d podman-machine-default -u root enterns podman cp /mnt/c/Users/XXX/Downloads/dump-data.sql [container_name]:/
orwsl -d podman-machine-default -u user enterns podman cp /mnt/c/"your file location" container:/sql/
. If neither works, double check username of podman machine withpodman ssh
andwhoami
.
To know more, visit this issue.
Subscribe to my newsletter
Read articles from Christine Lee directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by