Answer the question
In order to leave comments, you need to log in
How to effectively use Docker + Docker-compose in development?
I have never worked closely with docker, and now there is a need for this, since in the future the application will need to be deployed on a remote server.
I threw a small docker-compose based on knowledge from the information I read
version: '3'
services:
parser:
build: ./parser
restart: always
container_name: JaScrapy01
depends_on:
- postgres
- redis
volumes:
- ./parser:/JaScrapy
networks:
- net
env_file:
- .env
postgres:
image: postgres:11.3-alpine
restart: always
container_name: postgres01
networks:
- net
volumes:
- ./postgres/data:/var/lib/postgresql/data
env_file:
- .env
redis:
image: redis:5.0.5-alpine
restart: always
container_name: redis01
networks:
- net
volumes:
- ./redis/data:/data
env_file:
- .env
networks:
net:
Answer the question
In order to leave comments, you need to log in
but you can’t connect to them from the outside (due to the use of networks, and how to open a network -
you need to guess yourself)
When making any changes to the main application
, one can only hope that they will someday appear in the container
You can delete the container with the application five times, then delete the image ten times,
no changes will get anywhere.
In this case, it is impossible to use a virtual environment on the local machine, launching the application through it,
because the database network is local somewhere.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question