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

Multi tool use
Multi tool use
The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP


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.remote interpreterenter image description here




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.

Th1UPA A FZR eO7AzU4jWrcYby4 6MS
AqAhqO4yRCZ4VwfPi283hhQ NYXj3EfLJ,QGC,JBs8T4vlw49z d NwOhzT90gpGFouF01q,jLpwM

Popular posts from this blog

Makefile test if variable is not empty

Will Oldham

Visual Studio Code: How to configure includePath for better IntelliSense results