how to make Docker-compose run all services when debuging with Pycharm?

Multi tool use


how to make Docker-compose run all services when debuging with Pycharm?
I have a simple dockerized Django gunicorn, nginx, and postgress project (each is a service).
When I run it with docker-compose up, everything works:
maximd@ubuntu ~/PycharmProjects/MyQ (master) $ docker-compose ps
Name Command State Ports
-------------------------------------------------------------------------------
myq_database1_1 docker-entrypoint.sh postgres Up 5432/tcp
myq_djangoapp_1 /bin/sh -c gunicorn --bind ... Up 8000/tcp
myq_nginx_1 nginx -g daemon off; Up 0.0.0.0:8000->80/tcp
however when I lunch it though the debug of pycharm, it doesn't run nginx, I suspect that since in my docker-compose.yml file the djangoapp depends on the database service, it just creates them both, but it doesn't run nginx.
Here is what I see after I run the debug:
maximd@ubuntu ~/PycharmProjects/MyQ (master) $ docker-compose ps
Name Command State Ports
----------------------------------------------------------------------------------------------
myq_database1_1 docker-entrypoint.sh postgres Up 5432/tcp
myq_djangoapp_1 python -u /opt/.pycharm_he ... Up 0.0.0.0:55488->55488/tcp, 8000/tcp
myq_nginx_1 nginx -g daemon off; Exit 0
So, my question is, is there a way to make nginx be a dependency of djangoapp also?, or is there a way to make pycharm run all services and not only the one I'm trying to debug?
Here is my docker-compose.yml file:
version: '3'
services:
djangoapp:
build: .
volumes:
- .:/services/djangoapp
- static_volume:/services/djangoapp/static
- media_volume:/services/djangoapp/media
networks:
- nginx_network
- database1_network
depends_on:
- database1
nginx:
image: nginx:1.13
ports:
- 8000:80
volumes:
- ./config/nginx/conf.d:/etc/nginx/conf.d
- static_volume:/services/djangoapp/static
- media_volume:/services/djangoapp/media
depends_on:
- djangoapp
networks:
- nginx_network
database1: # <-- IMPORTANT: same name as in DATABASES setting, otherwise Django won't find the database!
image: postgres:10
env_file:
- config/db/database1_env
networks:
- database1_network
volumes:
- database1_volume:/var/lib/postgresql/data
networks:
nginx_network:
driver: bridge
database1_network:
driver: bridge
volumes:
database1_volume:
static_volume:
media_volume:
Here is my debug configuration and interpreter configuration in the pictures.
1 Answer
1
I suspect your nginx container is going down on it's own, just check docker logs myq_nginx_1
docker logs myq_nginx_1
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.