Hello, I might have found an issue but before I op...
# general
w
Hello, I might have found an issue but before I open a ticket on Github I wanted to check with y’all. I’m using pants to run a docker container with the following command:
Copy code
./pants run :linux-pyenv --docker-run-args="--rm -it -v $(pwd):/app"
which works fine, flags and volume get assigned as expected. Now when I move that into the
pants.toml
file, which I did as follow:
Copy code
[docker]
run_args = "--rm -it -v $(pwd):/app"
then I get this error:
Copy code
11:02:24.76 [INFO] Initializing scheduler...
11:02:24.95 [INFO] Scheduler initialized.
11:02:55.41 [INFO] Completed: Building docker image linux-pyenv:latest
docker: Error response from daemon: create $(pwd): "$(pwd)" 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.
See 'docker run --help'.
If I were to guess, this looks like some parsing/casting issue when reading from the toml file and sending it to docker since when I run directly from the command line it works as expected. I’ve already tried single quotes, escaping “$” and parenthesis but nothing seems to work. 😞
2
h
you can't run arbitrary commands in
pants.toml
. Instead, you could use
"%(buildroot)s
❤️ 1
w
You’re a life savior. That worked like a charm, and the arbitrary command thing makes sense, that’d be a security issue.
❤️ 1
What about calling a local environment variable? I have that path also set as $PWD, is there any way to use that instead or it falls into the same problem as you described?
h
John added support in https://github.com/pantsbuild/pants/pull/15087 which I think is in 2.12
w
Oh man, it’s exciting to be back ha!
👋 1
❤️ 2