Run an existing Docker image, mount the local directory to it, and execute the command line options in /bin/bash #602
Unanswered
kovar-ursa
asked this question in
Q&A
Replies: 1 comment 3 replies
-
Hi there! Thanks for trying out this package! There is definitly improvements we could do in terms of checking the types of input, which is the error that you are hitting now. I think you want something like this: docker.run( "docker.io/me/xcompile:latest@sha256:c8c5cc44c4a14c55d36e09cbdd3f175ca74a6b5ad5121a0f75346f66272228dd", ["make", "all"], volumes=[(pwd, "/builddir")], interactive=True, tty=True, detach=False ) You can take a look at the docs for docker run here: https://gabrieldemarmiesse.github.io/python-on-whales/sub-commands/container/#python_on_whales.components.container.cli_wrapper.ContainerCLI.run let me know if you need more help! |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I've built a Docker image with various toolchains for compiling on different architectures. I used buildx to create a multi-architecture image and run this with:
docker run -it -v $(pwd)/:/builddir docker.io/me/xcompile:latest@sha256:0a3d9cdcbc8c3364b884d697598e17437b360153d5d62f8fc55b62b19db8e777 make all
So, mount the current directory into the image, run a specific version of the image, and execute
make all
.What is the whales version of this where "make all" is a command line option?
I've tried this:
docker.run( ["docker.io/me/xcompile:latest@sha256:c8c5cc44c4a14c55d36e09cbdd3f175ca74a6b5ad5121a0f75346f66272228dd"], volumes=[pwd, "/builddir"], interactive=True, tty=True, detach=False )
The volumes section produces errors where both pwd and the "/builddir" look like:
/:b:u:i:l:d:d:i:r:
This appears to be a LOT easier than using subprocess once I figure it out.
Beta Was this translation helpful? Give feedback.
All reactions