[Resolved] Connect to host db problem after reboot

Hi,

I’ve got in a problem since my server rebooted last time.

My container can’t access anymore to my DB and I don’t understand why, I’ve tried many things different without success.

If anyone have a suggestion please.

I check if it’s running with ‘netstat -na’ and my port 5432 is listen, that’s ok

and with is my docker-compose

version: ‘2’

services:
django:
restart: always
build: .
container_name: django
command: bash -c "python manage makemigrations && python manage migrate --noinput && gunicorn brick_reader_api.wsgi:application --bind 0.0.0.0:8001"
networks:
- reverse-proxy
- back
extra_hosts:
- "local:172.17.0.1"
volumes:
- ./src:/src
- ./media:/media
expose:
- 8001
environment:
- VIRTUAL_HOST=XXXX
- LETSENCRYPT_EMAIL=XXXX
- LETSENCRYPT_HOST=XXXX

networks:
reverse-proxy:
external:
name: reverse-proxy
back:
driver: bridge

So I face the error could not connect to server: Connection refused
Is the server running on host “local” (172.17.0.1) and accepting
TCP/IP connections on port 5432?

But I configured everything right no ?

Thanks you

is the server the docker host? or another machine

Yes the server is the docker host

is the host windows, is the firewall preventing connections… is the db permitting connections from remote clients (mysql and mongo both default to NOT allowing remote connections)

also 172.17.0.1 is NOT the host… it is the GATEWAY…

you would have to use the real host IP address

It’s on a linux server. I use the 172.17.0.1 because it’s the bridge between my container and my host.

Before the reboot of the server, everything worked fine

did the gateway address change?

Nop, I checked with docker network inspect, and ip addr nothing change

did the docker version change? we have seen some crazy changes

No, I didn’t update anything and it’s not change

and from the container, can u still access the server (docker host) ip address via ping?

Ok.

Yeah everything was working fine I checked every discussion one by one.

I found the problem came from the db who reseted the password after restart.

Thanks you