Answer the question
In order to leave comments, you need to log in
How to create a container in docker so that files are taken from an external directory?
Explain in simple terms about creating a docker container.
I have already read a bunch of documentation and tutorials, I use docker itself and want to create my own container.
Here I have a code on a node and on a python, which versions are selected for this whole set so that everything starts up and the necessary dependencies are added. Question one: Python has additional modules installed, there is no package.json analogue, so, as I understand it, it is necessary to prescribe the installation of these modules manually, or what?
Then there is the code, which is unchanged, there are configs and a directory with changing files.
Here's how to create a container that will contain immutable code and work with configs and files from outside? At least a simple example.
Answer the question
In order to leave comments, you need to log in
Package.json analog - requirements.txt file for pip or analogs for other systems like pipenv.
We make a container in which we add our code, something like this:
ADD app /app
WORKDIR /app
RUN apt install python3-pip && pip install -r requirements.txt
docker run -itd --name my_service -v `pwd`/config:/app/config:ro -v /var/log/my_project/my_service:/app/log my_awesome_image
volumes:
- ./config:/app/config:ro
- /var/log/my_project/my_service:/app/log
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question