'how to run cli command from container_1 onto in container_2 in a docker-compose setup [duplicate]

I have Elixir/Phoenix server, based on user requirements server generates markdown and latex files, then it runs System.cmd("pandoc", [relevant commands]) to generate PDF files everything works fine in the local system, here the dependencies are (pandoc and latex) installed locally

now I'm trying to dockerize the project. I tried installing pandoc and latex in phoenix_server container and it worked fine but the final docker image size increased to 8.5GB because texlive itself has 7.5GB so its not an option

I found this pandoc/latex:2.18 image

so my idea is to create 3 docker containers and run docker-compose up

container_1: Phoenix_server
container_2: postgres:14
container_3: pandoc/latex:2.18

but it didn't worked.

challenges:

1 sharing server generated file's with pandoc/latex container, for this I'm thinking to using docker volume option

2 I could not figure out how to run cli commands from phoenix container onto in pandoc/latex container

any help is greatly appreciated

Thank you



Solution 1:[1]

  1. To be fair, if you're not using distributed erlang in this case, I would just install Elixir to the pandoc image and left postgres as an external container / managed db as you did.

  2. When you want to distribute calculations like you are trying with containers, I would probably put some queue (postgres + Oban as a option looks good here) and started elixir process in the pandoc image which can do the rendering and save outputs to the shared volume.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Mikhail Aksenov