Python Forum
Docker-compose on Pycharm - Connection refused
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Docker-compose on Pycharm - Connection refused
#1
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
Reply
#2
and how this is python related?
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply
#3
PyCharm IDE forum: https://intellij-support.jetbrains.com/h...35-PyCharm
rstambach likes this post
Reply
#4
(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.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
Lightbulb shutdown host from docker container cosmin1805 0 947 Nov-27-2022, 06:34 PM
Last Post: cosmin1805
  Issue in Starting Django project with Docker Prabakaran141 0 819 Sep-26-2022, 12:15 PM
Last Post: Prabakaran141
  Docker -building a python image saisankalpj 5 3,920 Jul-13-2022, 12:53 PM
Last Post: saisankalpj
  Serial connection connection issue Joni_Engr 15 8,020 Aug-30-2021, 04:46 PM
Last Post: deanhystad
  Cannot bring up anaconda in Docker image ErnestTBass 1 1,806 Aug-15-2020, 04:12 AM
Last Post: ndc85430
  Compose nested JSON with multi columns in Python praveenks 1 3,760 Oct-20-2018, 11:31 PM
Last Post: Larz60+
  Nginx Uwsgi Django 111 Connection refused while connecting to upstream sandyman 0 5,101 Sep-18-2017, 07:05 AM
Last Post: sandyman
  instruction refused on a "while loop" sylas 11 7,846 May-22-2017, 08:09 AM
Last Post: sylas

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020