Hi folks :wave:. When I'm trying to use a `docker_...
# general
l
Hi folks 👋. When I'm trying to use a
docker_image
target as a runnable dependency in
adhoc_tool
or
shell_command
like so
Copy code
docker_image(
    name = "image",
)

shell_command(
    name = "foo",
    command = """
    image-builder
    """,
    runnable_dependencies = [
        ":image-builder",
    ],
)
And trying to run foo using
pants export-codegen //:foo
I get
Copy code
the input device is not a TTY
If I explicitly add
--interactive=false
to the docker_image then it works for the build target:
Copy code
docker_image(
    name = "image",
    extra_run_args = [
        "--interactive=false",
    ],
    image_tags = ["dev"],
)
But then I'm unable to run a shell using
pants run //:image -- /bin/bash
which can be very helpful for debugging. Is it possible to add additional docker run flags when doing
pants run
? Or is it possible to not automatically add the
--interactive
flag when the docker_image is being used by another build rule? Is this something I can (automatically) do myself?
f
have you seen below docs for the docker subsystem? https://www.pantsbuild.org/2.21/reference/subsystems/docker#run_args i think that should cover your use case …
l
The arguments for the image entrypoint may be passed on the command line after a double dash (
--
), or using the
--run-args
option.
Defaults to
--interactive --tty
when stdout is connected to a terminal.
Interesting, thanks!
Then I guess it's maybe a bug, that building
:foo
in the example makes pants think that stdout is corrected to a terminal