S
S
S1riyS2021-12-28 18:40:44
Python
S1riyS, 2021-12-28 18:40:44

How to work with multiple Dockerfiles in one project?

In continuation to my previous question .
1) I installed Docker and roughly understood how to work with it, but since my project should be able to execute code in different languages ​​=> I should have several images.

I'm guessing it should look something like this: The temp
61cb2d535875f254780285.png
folder will store scripts submitted by users. Is this structure correct? 2) In theory, to run a script in any language, I only need one image that describes the execution of the script in this language, but in order to execute the file I need every time, when I start the container, I need to somehow transfer the file name there , how to do it? 3) To work with


Docker from Python , I found the docker library , is it worth using it or is it better to run containers in some other way, and if so, which one?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vladimir Kuts, 2021-12-28
@S1riyS

Dockerfile for each container is optional. Dockerfile - mostly for specific cases. For example, 80 percent of my containers just use some kind of python: 3.9, and all libraries are mounted into a virtual environment directly at startup.
But if necessary, then put it where it is convenient for you, and connect the directory in the context for the image build.

but in order for the file I need to be executed every time, when I start the container, I need to somehow transfer the file name there, how can I do this?

mount the directory - yes, the necessary files from it and run
3) To work with Docker from Python, I found the docker library, is it worth using

It is for rather specific docker use cases. It's easier to run containers with some docker-composer

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question