503 Service Unavailable when Keycloak is started with a Docker subnet

223 views
Skip to first unread message

John

unread,
May 13, 2020, 8:59:32 AM5/13/20
to Keycloak User

Hi All,

Could help me to configure Keycloak behind Docker subnet?

Working solution:

```
version: "3.5"
services:
  keycloak:
    image: quay.io/keycloak/keycloak:latest
    restart: always
    environment:
      - DB_VENDOR=MYSQL
      - DB_ADDR=host.docker.internal
      - DB_PORT=3306
      - "rest envs..."
    ports:
      - 127.0.0.1:9080:8080
    network_mode: bridge
```

It does not work in this way:

```version: "3.5"
services:
  keycloak:
    image: quay.io/keycloak/keycloak:latest
    restart: always
    environment:
      - DB_VENDOR=MYSQL
      - DB_ADDR=host.docker.internal
      - DB_PORT=3306
      - "rest envs..."
    ports:
      - 127.0.0.1:9081:8080
    networks:
      - app_net

networks:
  app_net:
    name: app_net
    driver: bridge

```

or 

```
version: "3.8"
services:
  keycloak:
    image: quay.io/keycloak/keycloak:latest
    restart: always
    environment:
      - DB_VENDOR=MYSQL
      - DB_ADDR=host.docker.internal
      - DB_PORT=3306
      - "rest envs..."
    ports:
      - 127.0.0.1:9081:8080
    networks:
      app_net:
        ipv4_address: 172.16.238.10

networks:
  app_net:
    ipam:
      driver: default
      config:
        - subnet: "172.16.238.0/24"
```

Is it a problem of `quay.io/keycloak/keycloa` image?

Thanks!

John

unread,
May 13, 2020, 9:01:24 AM5/13/20
to Keycloak User
I forgot to add a log from wget:

```
wget http://172.20.13.10:8080
--2020-05-13 12:35:07--  http://172.16.238.10:8080/
Connecting to 172.20.13.10:8080... connected.
HTTP request sent, awaiting response... 503 Service Unavailable
2020-05-13 12:35:30 ERROR 503: Service Unavailable.
```
Reply all
Reply to author
Forward
0 new messages