Hi, I am new to pants and build systems in general...
# general
Hi, I am new to pants and build systems in general, I would like to be able to run end/or deploy services described in a docker-compose file. I could not find any mention to docker-compose files on the docker session of the docs. As an exemple, I am using the following command to build and run my application on docker:
./pants run --docker-run-args="--gpus all --privileged -v /dev:/dev" docker/semantic_segmentation/Dockerfile-gpu
I would like to call a docker-compose file with all the run-args defined in it, how can that be done though pants, so it will build the .pex file?
👋 2
I don't think anyone has added docker-compose support yet. And I don't see an issue. Mind filing one with as much useful info as possible?
I suspect it wouldn't be too hard to add, once someone gets familiar with the internals. If you're interested in implementing, let us know we'd love to help you!
Thank you for the reply. But there is a way of storing default
per Dockerfile? I saw that I can add
run_args = ["arg",...]
on the
, but this would act globally.
I don't see a field on https://www.pantsbuild.org/docs/reference-docker_image for this. It can likely be added, though. Same spiel about issues and contributions apply here as well 🙂
Hi @creamy-ghost-8929 . We're always interested in improving Docker support, and docker-compose does come up from time to time, so an issue would be really valuable so we can use it to start that conversation.
Adding per-target arguments for
is interesting, and might even make sense as a generic feature, not just for
targets but for any runnable target
What are some examples of args you'd want to use this for?
(I think the original post has one example in it 😉 )
Ah, so like
--gpus all --privileged -v /dev:/dev
Port forwarding is also very common
Yeah, makes sense
Wondering if it makes sense as a generic feature of runnable targets?
Thank you. I found a work around by building the image with ./pants package <path-to-Dockerfile>, then referencing the built image on the docker-compose.yaml file. I am still learning how to use pants, once I get a better grasp, I will be able to explain better the use cases and I will create the issue.
@happy-kitchen-89482 I think so, although I'd maybe wanna think about it more. we probably want to make a convention about it
Yeah, if we think that's the direction it would be good to add it the right way
maybe a RunnableTarget mixin or something
For reference,
related targets now have
. so slight convention about using