I'm trying to run a SQL script against a SQL Server instance that is running inside a Podman container on a Windows 11 host.
To do this, I'm attempting to copy the script file to the container using the following command:
podman cp .\baseline.sql mssql-server-1:/tmp/baseline.sql
it returns:
error rewriting "c:....\baseline.sql" to be relative to "/": expected root directory to be an absolute path, got "/"
It seams the paths are ok, because if I change either the source or destination Podman reports correctly the error.
Has anyone encountered a similar issue or can provide insight into what might be going wrong here? Any advice or suggestions would be greatly appreciated.
This is generally followed by containers/podman
issue 14862:
In the meantime as a workaround you can access your windows drive through the mount that is on the wsl linux host, using unix path conventions, like this:
podman cp /mnt/c/users/foo/bar/file.bak mycontainer:/var/opt/backups
And:
I was able to get a file copy into my container working with the following.
I redeployed my podman machine, rebuilt my container...
this does work:wsl -d podman-machine-default -u user enterns podman cp \ /mnt/d/2022_Projects/assessments/HK197500195.bin se92:/root/
Or:
wsl -d podman-machine-default -u user enterns podman cp \ /mnt/c/"your file location" container:/sql/
Meaning:
"Prefixing"
docker cp
withwsl -d podman-machine-default -u user enterns
also worked for me. Concretely, I wrote:wsl -d podman-machine-default -u user enterns podman cp \ "myfile.txt" my-container-name:/tmp/
Also:
Simple workaround for me is to use
podman machine ssh
command like this:podman machine ssh "podman cp /mnt/c/dev/file.py container:/usr/src/app"