# Setup w/ postgreSQL error: "connect: no route to host"

**URL:** <https://forum.gitea.com/t/setup-w-postgresql-error-connect-no-route-to-host/7125>\
**Category:** Install/Maintain/Configure\
**Created:** [April 21, 2023, 9:16am UTC](https://forum.gitea.com/t/setup-w-postgresql-error-connect-no-route-to-host/7125 "2023-04-21T09:16:23Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![henryfung3a27](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.gitea.com/henryfung3a27/32/3623_2.png) [@henryfung3a27](https://forum.gitea.com/u/henryfung3a27)\
**Post date:** [April 21, 2023, 9:16am UTC](https://forum.gitea.com/t/setup-w-postgresql-error-connect-no-route-to-host/7125/1 "2023-04-21T09:16:23Z")

</div>

I wanna try hosting `Gitea` with `Postgresql` on my openEuler server. I have the following `docker-compose.yml`.

```yml
version: "3.7"

services:
  server:
    image: gitea/gitea:1
    container_name: gitea
    environment:
      - USER_UID=1000
      - USER_GID=1000
      - GITEA __database__ DB_TYPE=postgres
      - GITEA __database__ HOST=db:5432
      - GITEA __database__ NAME=gitea
      - GITEA __database__ USER=gitea
      - GITEA __database__ PASSWD=gitea
    restart: always
    networks:
      - gitea
    volumes:
      - ./data/gitea:/data
      - /etc/localtime:/etc/localtime:ro
    ports:
      - "8000:3000"
      - "8022:22"
    depends_on:
      - db
  db:
    image: postgres:14
    restart: always
    environment:
      - POSTGRES_USER=gitea
      - POSTGRES_PASSWORD=gitea
      - POSTGRES_DB=gitea
    networks:
      - gitea
    volumes:
      - ./data/postgres:/var/lib/postgresql/data

networks:
  gitea:
    name: gitea-net

```

Things are pretty much the same from [gitea website tutorial](https://docs.gitea.io/en-us/install-with-docker/).

Environment setup:

1. Gitea is running on Docker 18.09 on a openEuler 22.03 SP1 server (freshly installed)
2. Trying to access Gitea on another PC

On my PC, I accessed Gitea via Chrome `192.168.50.58:8000`. I can see the nice Setup page. I checked “Enable Local Mode” and added admin account. That’s it. I left the Database section untouched. They are pre-filled with the following data:

```auto
Database Type: PostgreSQL
Host: db:5432
Username: gitea
Password: gitea (I typed it again to ensure)
Database Name: gitea
SSL: Disabled
Schema: (blank)

```

Then I click “Install Gitea” and the following error is shown on top, and the fields in Database section is filled with red color.

```auto
The database settings are invalid: dial tcp 172.19.0.2:5432: connect: no route to host

```

* * *

I googled and done this:

```bash
firewall-cmd --permanent --zone=public --add-rich-rule='rule family=ipv4 source address=172.19.0.0/16 accept'
firewall-cmd --permanent --zone=public --add-masquerade
firewall-cmd --reload
systemctl restart firewalld # (just in case)
systemctl restart docker

```

But still the two containers are not communicating with each other (or so I think).

Any ideas?

* * *

Extra info

```auto
# firewall-cmd --list-all
public (active)
  target: default
  icmp-block-inversion: no
  interfaces: eno1
  sources:
  services: dhcpv6-client mdns ssh
  ports: 8000/tcp
  protocols:
  forward: yes
  masquerade: yes
  forward-ports:
  source-ports:
  icmp-blocks:
  rich rules:
        rule family="ipv4" source address="172.19.0.0/16" accept

```

```auto
# docker version
Client:
 Version: 18.09.0
 EulerVersion: 18.09.0.316
 API version: 1.39
 Go version: go1.17.3
 Git commit: 9b9af2f
 Built: Tue Dec 27 14:25:30 2022
 OS/Arch: linux/amd64
 Experimental: false

Server:
 Engine:
  Version: 18.09.0
  EulerVersion: 18.09.0.316
  API version: 1.39 (minimum version 1.12)
  Go version: go1.17.3
  Git commit: 9b9af2f
  Built: Tue Dec 27 14:24:56 2022
  OS/Arch: linux/amd64
  Experimental: false

```

```auto
# docker-compose --version
docker-compose version 1.22.0, build f46880f

```

---

<div class="post-metadata">

**Author:** ![henryfung3a27](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.gitea.com/henryfung3a27/32/3623_2.png) [@henryfung3a27](https://forum.gitea.com/u/henryfung3a27)\
**Post date:** [April 21, 2023, 10:56am UTC](https://forum.gitea.com/t/setup-w-postgresql-error-connect-no-route-to-host/7125/2 "2023-04-21T10:56:58Z")

</div>

I have successfully solved it by manually installing Docker 23. I didn’t even change the `docker-compose.yml`. Guess it’s the docker engine version too low

---

<div class="post-metadata">

**Author:** ![jake](https://avatars.discourse-cdn.com/v4/letter/j/f475e1/32.png) [@jake](https://forum.gitea.com/u/jake)\
**Post date:** [April 21, 2023, 2:40pm UTC](https://forum.gitea.com/t/setup-w-postgresql-error-connect-no-route-to-host/7125/3 "2023-04-21T14:40:42Z")

</div>

Glad you figured it out. I’m assuming Postgres was the issue in Docker and am not sure what version they recommend, but Gitea recommends at least Docker server `20.10.6` otherwise you run into issues with webhooks not working so upgrading was a good idea.
