You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The following 'docker run' command works fine from Windows CLI:
docker run -d --name <name> -p <port>:5432 -v <abspath>:/<container_path> postgres:latest
For the -v I have "/c/Users/user/directory with spaces/dir/dir/dir:/remote-path".
Using a python script, calling with subprocess.run() with the exact same arguments, it gets various docker errors.
I was able to get it to work in another directory with no quotes where there were no spaces in the directory names. Using it with quotes confused it again. But can't use that directory permanently either way.
I've tried using C:\Users\ etc, etc instead, I've tried with and without quotes in the whole thing or just the local path, and nothing works. I get various error messages between it trying to tell me my absolute path is not an absolute path, invalid format, and invalid mode.
Perhaps user error here but no matter what I do I get some sort of docker run error using -v from script, whereas from CLI directly it runs fine with the exact same command.
One example error:
docker: Error response from daemon: create "/c/Users/<user>/dir with spaces/dir/dir/dir: "\"/c/Users/<user>/dir with spaces/dir/dir/dir" includes invalid characters for a local volume name, only "[a-zA-Z0-9][a-zA-Z0-9_.-]" are allowed. If you intended to pass a host directory, use absolute path.
But again with the same path, don't get this from CLI directly.
Reproduce
Run from CLI, see that it works.
docker run -d --name postgres-test -p 15432:5432 -v "/c/Users/<user>/dir with spaces/dir/dir/dir:/docker-entrypoint-initdb.d postgres:latest
This fails whether I use quotes or not, where I put the quotes, if I switch the local path to C:\Users\<user>\dir with spaces\dir\dir\dir.
Expected behavior
Running via script calling the same command should have the same result? Unless I am being dumb and doing something very wrong / noobish, which is always possible.
Description
The following 'docker run' command works fine from Windows CLI:
For the -v I have "/c/Users/user/directory with spaces/dir/dir/dir:/remote-path".
Using a python script, calling with subprocess.run() with the exact same arguments, it gets various docker errors.
I was able to get it to work in another directory with no quotes where there were no spaces in the directory names. Using it with quotes confused it again. But can't use that directory permanently either way.
I've tried using C:\Users\ etc, etc instead, I've tried with and without quotes in the whole thing or just the local path, and nothing works. I get various error messages between it trying to tell me my absolute path is not an absolute path, invalid format, and invalid mode.
Perhaps user error here but no matter what I do I get some sort of docker run error using -v from script, whereas from CLI directly it runs fine with the exact same command.
One example error:
But again with the same path, don't get this from CLI directly.
Reproduce
Run from CLI, see that it works.
Run via code, see that it fails.
Something like:
This fails whether I use quotes or not, where I put the quotes, if I switch the local path to
C:\Users\<user>\dir with spaces\dir\dir\dir
.Expected behavior
Running via script calling the same command should have the same result? Unless I am being dumb and doing something very wrong / noobish, which is always possible.
docker version
Client: Cloud integration: v1.0.35+desktop.13 Version: 26.1.1 API version: 1.45 Go version: go1.21.9 Git commit: 4cf5afa Built: Tue Apr 30 11:48:43 2024 OS/Arch: windows/amd64 Context: default Server: Docker Desktop 4.30.0 (149282) Engine: Version: 26.1.1 API version: 1.45 (minimum version 1.24) Go version: go1.21.9 Git commit: ac2de55 Built: Tue Apr 30 11:48:28 2024 OS/Arch: linux/amd64 Experimental: false containerd: Version: 1.6.31 GitCommit: e377cd56a71523140ca6ae87e30244719194a521 runc: Version: 1.1.12 GitCommit: v1.1.12-0-g51d5e94 docker-init: Version: 0.19.0 GitCommit: de40ad0
docker info
Additional Info
No response
The text was updated successfully, but these errors were encountered: