How to podman cp on Windows

Christine LeeChristine Lee
1 min read

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.

  1. 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.

  2. Start the podman container. When I was running container from mysql:5.7 image, I set an environment variable MYSQL_ROOT_PASSWORD as well.

  3. 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 by pwd. Remember this path to the file!

  4. 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]:/ or wsl -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 with podman ssh and whoami.

To know more, visit this issue.

0
Subscribe to my newsletter

Read articles from Christine Lee directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Christine Lee
Christine Lee