Python Forum

Full Version: Docker-compose on Pycharm - Connection refused
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
This is the first time I've used Pycharm with docker-compose and I have this issue. I have a docker-compose.yml that works fine from bash execution but when I run it in Pycharm I'm getting
[error] 23#23: *29 connect() failed (111: Connection refused) while connecting to upstream, client: 172.23.0.1, server: , request: "GET /netbox/ HTTP/1.1", upstream: "http://172.23.0.2:7000/netbox/", host: "localhost:7001"

This is Ubuntu 18.04.5 on VirtualBox
My docker-compose.yml
version: '3'

# network
networks:
data:
management:

volumes:
postgres-data:
redis-data:

services:
nginx:
image: nginx
ports:
- "7001:80"
volumes:
- ./nginx.conf:/etc/nginx/conf.d/default.conf:ro
depends_on:
- web
command: [nginx-debug, '-g', 'daemon off;']
networks:
- management

db:
container_name: postgres
image: postgres:9.6.5
ports:
- "5432:5432"
restart: always
volumes:
# - postgres-data:/var/lib/postgresql/data/
- ../data:/docker-entrypoint-initdb.d # import SQL dump
# - ./pg_hba.conf:/var/lib/postgresql/data/pg_hba.conf
environment:
- POSTGRES_USER=netbox
- POSTGRES_PASSWORD=passw0rd
networks:
- data

web:
container_name: netbox_web
build:
context: .
dockerfile: Dockerfile
expose:
- "5432"
environment:
# set so to use db as database `
- DOCKER_CONTAINER="1"
- NETBOX_DEBUG=1
volumes:
- ../netbox:/code
working_dir: /code
ports:
- "7000:7000"
command: bash -c "python manage.py migrate --noinput && python manage.py runserver 0.0.0.0:7000"
# command:
# "gunicorn --workers=8 --timeout=300 --log-level=info
# --bind=0.0.0.0:8001 gitt.wsgi:application"

networks:
- data
- management
depends_on:
- db
- redis

redis:
image: redis
#ports:
# - '6380:6379'
volumes:
- redis-data:/data
networks:
- data

celery:
image: netbox_web
volumes:
- ../netbox:/code
working_dir: /code
environment:
# set so that Celery uses redis docker
- DOCKER_CONTAINER="1"
- NETBOX_DEBUG=0
command: celery -A netbox worker -l INFO
networks:
- data
depends_on:
- db
- redis

schemaspy:
image: andrewjones/schemaspy-postgres:latest
command: ["-host", "db", "-u", "netbox", "-p", "passw0rd", "-db", "netbox"]
volumes:
- ../docs/schema:/output
networks:
- data
depends_on:
- db
and how this is python related?
(Apr-05-2021, 09:31 AM)Larz60+ Wrote: [ -> ]PyCharm IDE forum: https://intellij-support.jetbrains.com/h...35-PyCharm

Thanks, Larz60+, sorry for posting in the wrong forum.