Skip to content

[BUG] Docker image evoapicloud/evolution-api:latest fails to start with P1001 error despite healthy dependencies #2050

@backupsGit

Description

@backupsGit

Welcome!

  • Yes, I have searched for similar issues on GitHub and found none.

What did you do?

Hello, I am trying to run the Evolution API using the official Docker Compose setup, but the API container is stuck in a restart loop.

Environment:

  • OS: Oracle Linux
  • Docker: [Pega aquí la versión de tu Docker, la obtienes con docker --version]
  • Image: evoapicloud/evolution-api:latest

Problem:
The evolution-postgres and evolution_redis containers start and become healthy. The api container waits for them (using depends_on with service_healthy), starts, but then immediately crashes and restarts.

Logs:
The log from the api container repeatedly shows this error, even after trying multiple configurations:

Error: P1001: Can't reach database server at 'postgres:5432'

Configuration Files:
This is my current setup, which includes a network alias and healthchecks, but the error persists.

.env file:
(Remember to hide your actual password if you post it)

API Config
API_KEY=MySecretKey
PORT=8080

PostgreSQL Config
POSTGRES_DATABASE=evolution_db
POSTGRES_USERNAME=evolution_user
POSTGRES_PASSWORD=MyPostgresPassword

Connection Variables for the API
DATABASE_PROVIDER=postgresql
DATABASE_HOST=evolution-postgres
DATABASE_PORT=5432
DATABASE_USER=POSTGRES
U

SERNAMEDATABASE
N

AME={POSTGRES_DATABASE}
DATABASE_PASS=${POSTGRES_PASSWORD}

Redis Config
REDIS_HOST=evolution-redis
REDIS_PORT=6379
REDIS_PASSWORD=''

docker-compose.yml file:

services:
  api:
    container_name: evolution_api
    image: evoapicloud/evolution-api:latest
    restart: always
    depends_on:
      redis:
        condition: service_healthy
      evolution-postgres:
        condition: service_healthy 
    ports:
      - "8081:8080"
    environment:
      - API_KEY=${API_KEY}
      - PORT=${PORT}
      - DATABASE_PROVIDER=${DATABASE_PROVIDER}
      - DATABASE_HOST=${DATABASE_HOST}
      - DATABASE_PORT=${DATABASE_PORT}
      - DATABASE_USER=${DATABASE_USER}
      - DATABASE_NAME=${DATABASE_NAME}
      - DATABASE_PASS=${DATABASE_PASS}
      - REDIS_HOST=${REDIS_HOST}
      - REDIS_PORT=${REDIS_PORT}
      - REDIS_PASSWORD=${REDIS_PASSWORD}
    volumes:
      - evolution_instances:/evolution/instances
    networks:
      - evolution-net

  redis:
    container_name: evolution_redis
    image: redis:latest
    restart: always
    command: redis-server --port 6379 --appendonly yes
    volumes:
      - evolution_redis:/data
    networks:
      - evolution-net
    healthcheck:
      test: ["CMD", "redis-cli", "ping"]
      interval: 10s
      timeout: 5s
      retries: 5

  evolution-postgres:
    container_name: evolution_postgres
    image: postgres:15
    restart: always
    environment:
      - POSTGRES_DB=${POSTGRES_DATABASE}
      - POSTGRES_USER=${POSTGRES_USERNAME}
      - POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
    volumes:
      - postgres_data:/var/lib/postgresql/data
    networks:
      evolution-net:
        aliases:
          - postgres
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USERNAME} -d ${POSTGRES_DATABASE}"]
      interval: 10s
      timeout: 5s
      retries: 5

volumes:
  evolution_instances:
  evolution_redis:
  postgres_data:

networks:
  evolution-net:
    driver: bridge



### What did you expect?

Hello, I am trying to run the Evolution API using the official Docker Compose setup, but the API container is stuck in a restart loop.

**Environment:**
* OS: Oracle Linux
* Docker: [Pega aquí la versión de tu Docker, la obtienes con `docker --version`]
* Image: `evoapicloud/evolution-api:latest`

**Problem:**
The `evolution-postgres` and `evolution_redis` containers start and become healthy. The `api` container waits for them (using `depends_on` with `service_healthy`), starts, but then immediately crashes and restarts.

**Logs:**
The log from the `api` container repeatedly shows this error, even after trying multiple configurations:

Error: P1001: Can't reach database server at 'postgres:5432'

**Configuration Files:**
This is my current setup, which includes a network alias and healthchecks, but the error persists.

**`.env` file:**
(Remember to hide your actual password if you post it)


API Config
API_KEY=MySecretKey
PORT=8080

PostgreSQL Config
POSTGRES_DATABASE=evolution_db
POSTGRES_USERNAME=evolution_user
POSTGRES_PASSWORD=MyPostgresPassword

Connection Variables for the API
DATABASE_PROVIDER=postgresql
DATABASE_HOST=evolution-postgres
DATABASE_PORT=5432
DATABASE_USER=POSTGRES 
U

 SERNAMEDATABASE 
N

 AME={POSTGRES_DATABASE}
DATABASE_PASS=${POSTGRES_PASSWORD}

Redis Config
REDIS_HOST=evolution-redis
REDIS_PORT=6379
REDIS_PASSWORD=''

**`docker-compose.yml` file:**
```yaml
services:
  api:
    container_name: evolution_api
    image: evoapicloud/evolution-api:latest
    restart: always
    depends_on:
      redis:
        condition: service_healthy
      evolution-postgres:
        condition: service_healthy 
    ports:
      - "8081:8080"
    environment:
      - API_KEY=${API_KEY}
      - PORT=${PORT}
      - DATABASE_PROVIDER=${DATABASE_PROVIDER}
      - DATABASE_HOST=${DATABASE_HOST}
      - DATABASE_PORT=${DATABASE_PORT}
      - DATABASE_USER=${DATABASE_USER}
      - DATABASE_NAME=${DATABASE_NAME}
      - DATABASE_PASS=${DATABASE_PASS}
      - REDIS_HOST=${REDIS_HOST}
      - REDIS_PORT=${REDIS_PORT}
      - REDIS_PASSWORD=${REDIS_PASSWORD}
    volumes:
      - evolution_instances:/evolution/instances
    networks:
      - evolution-net

  redis:
    container_name: evolution_redis
    image: redis:latest
    restart: always
    command: redis-server --port 6379 --appendonly yes
    volumes:
      - evolution_redis:/data
    networks:
      - evolution-net
    healthcheck:
      test: ["CMD", "redis-cli", "ping"]
      interval: 10s
      timeout: 5s
      retries: 5

  evolution-postgres:
    container_name: evolution_postgres
    image: postgres:15
    restart: always
    environment:
      - POSTGRES_DB=${POSTGRES_DATABASE}
      - POSTGRES_USER=${POSTGRES_USERNAME}
      - POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
    volumes:
      - postgres_data:/var/lib/postgresql/data
    networks:
      evolution-net:
        aliases:
          - postgres
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USERNAME} -d ${POSTGRES_DATABASE}"]
      interval: 10s
      timeout: 5s
      retries: 5

volumes:
  evolution_instances:
  evolution_redis:
  postgres_data:

networks:
  evolution-net:
    driver: bridge



### What did you observe instead of what you expected?

Hello, I am trying to run the Evolution API using the official Docker Compose setup, but the API container is stuck in a restart loop.

**Environment:**
* OS: Oracle Linux
* Docker: [Pega aquí la versión de tu Docker, la obtienes con `docker --version`]
* Image: `evoapicloud/evolution-api:latest`

**Problem:**
The `evolution-postgres` and `evolution_redis` containers start and become healthy. The `api` container waits for them (using `depends_on` with `service_healthy`), starts, but then immediately crashes and restarts.

**Logs:**
The log from the `api` container repeatedly shows this error, even after trying multiple configurations:

Error: P1001: Can't reach database server at 'postgres:5432'

**Configuration Files:**
This is my current setup, which includes a network alias and healthchecks, but the error persists.

**`.env` file:**
(Remember to hide your actual password if you post it)


API Config
API_KEY=MySecretKey
PORT=8080

PostgreSQL Config
POSTGRES_DATABASE=evolution_db
POSTGRES_USERNAME=evolution_user
POSTGRES_PASSWORD=MyPostgresPassword

Connection Variables for the API
DATABASE_PROVIDER=postgresql
DATABASE_HOST=evolution-postgres
DATABASE_PORT=5432
DATABASE_USER=POSTGRES 
U

 SERNAMEDATABASE 
N

 AME={POSTGRES_DATABASE}
DATABASE_PASS=${POSTGRES_PASSWORD}

Redis Config
REDIS_HOST=evolution-redis
REDIS_PORT=6379
REDIS_PASSWORD=''

**`docker-compose.yml` file:**
```yaml
services:
  api:
    container_name: evolution_api
    image: evoapicloud/evolution-api:latest
    restart: always
    depends_on:
      redis:
        condition: service_healthy
      evolution-postgres:
        condition: service_healthy 
    ports:
      - "8081:8080"
    environment:
      - API_KEY=${API_KEY}
      - PORT=${PORT}
      - DATABASE_PROVIDER=${DATABASE_PROVIDER}
      - DATABASE_HOST=${DATABASE_HOST}
      - DATABASE_PORT=${DATABASE_PORT}
      - DATABASE_USER=${DATABASE_USER}
      - DATABASE_NAME=${DATABASE_NAME}
      - DATABASE_PASS=${DATABASE_PASS}
      - REDIS_HOST=${REDIS_HOST}
      - REDIS_PORT=${REDIS_PORT}
      - REDIS_PASSWORD=${REDIS_PASSWORD}
    volumes:
      - evolution_instances:/evolution/instances
    networks:
      - evolution-net

  redis:
    container_name: evolution_redis
    image: redis:latest
    restart: always
    command: redis-server --port 6379 --appendonly yes
    volumes:
      - evolution_redis:/data
    networks:
      - evolution-net
    healthcheck:
      test: ["CMD", "redis-cli", "ping"]
      interval: 10s
      timeout: 5s
      retries: 5

  evolution-postgres:
    container_name: evolution_postgres
    image: postgres:15
    restart: always
    environment:
      - POSTGRES_DB=${POSTGRES_DATABASE}
      - POSTGRES_USER=${POSTGRES_USERNAME}
      - POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
    volumes:
      - postgres_data:/var/lib/postgresql/data
    networks:
      evolution-net:
        aliases:
          - postgres
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USERNAME} -d ${POSTGRES_DATABASE}"]
      interval: 10s
      timeout: 5s
      retries: 5

volumes:
  evolution_instances:
  evolution_redis:
  postgres_data:

networks:
  evolution-net:
    driver: bridge



### Screenshots/Videos

_No response_

### Which version of the API are you using?

Hello, I am trying to run the Evolution API using the official Docker Compose setup, but the API container is stuck in a restart loop.

**Environment:**
* OS: Oracle Linux
* Docker: [Pega aquí la versión de tu Docker, la obtienes con `docker --version`]
* Image: `evoapicloud/evolution-api:latest`

**Problem:**
The `evolution-postgres` and `evolution_redis` containers start and become healthy. The `api` container waits for them (using `depends_on` with `service_healthy`), starts, but then immediately crashes and restarts.

**Logs:**
The log from the `api` container repeatedly shows this error, even after trying multiple configurations:

Error: P1001: Can't reach database server at 'postgres:5432'

**Configuration Files:**
This is my current setup, which includes a network alias and healthchecks, but the error persists.

**`.env` file:**
(Remember to hide your actual password if you post it)


API Config
API_KEY=MySecretKey
PORT=8080

PostgreSQL Config
POSTGRES_DATABASE=evolution_db
POSTGRES_USERNAME=evolution_user
POSTGRES_PASSWORD=MyPostgresPassword

Connection Variables for the API
DATABASE_PROVIDER=postgresql
DATABASE_HOST=evolution-postgres
DATABASE_PORT=5432
DATABASE_USER=POSTGRES 
U

 SERNAMEDATABASE 
N

 AME={POSTGRES_DATABASE}
DATABASE_PASS=${POSTGRES_PASSWORD}

Redis Config
REDIS_HOST=evolution-redis
REDIS_PORT=6379
REDIS_PASSWORD=''

**`docker-compose.yml` file:**
```yaml
services:
  api:
    container_name: evolution_api
    image: evoapicloud/evolution-api:latest
    restart: always
    depends_on:
      redis:
        condition: service_healthy
      evolution-postgres:
        condition: service_healthy 
    ports:
      - "8081:8080"
    environment:
      - API_KEY=${API_KEY}
      - PORT=${PORT}
      - DATABASE_PROVIDER=${DATABASE_PROVIDER}
      - DATABASE_HOST=${DATABASE_HOST}
      - DATABASE_PORT=${DATABASE_PORT}
      - DATABASE_USER=${DATABASE_USER}
      - DATABASE_NAME=${DATABASE_NAME}
      - DATABASE_PASS=${DATABASE_PASS}
      - REDIS_HOST=${REDIS_HOST}
      - REDIS_PORT=${REDIS_PORT}
      - REDIS_PASSWORD=${REDIS_PASSWORD}
    volumes:
      - evolution_instances:/evolution/instances
    networks:
      - evolution-net

  redis:
    container_name: evolution_redis
    image: redis:latest
    restart: always
    command: redis-server --port 6379 --appendonly yes
    volumes:
      - evolution_redis:/data
    networks:
      - evolution-net
    healthcheck:
      test: ["CMD", "redis-cli", "ping"]
      interval: 10s
      timeout: 5s
      retries: 5

  evolution-postgres:
    container_name: evolution_postgres
    image: postgres:15
    restart: always
    environment:
      - POSTGRES_DB=${POSTGRES_DATABASE}
      - POSTGRES_USER=${POSTGRES_USERNAME}
      - POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
    volumes:
      - postgres_data:/var/lib/postgresql/data
    networks:
      evolution-net:
        aliases:
          - postgres
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USERNAME} -d ${POSTGRES_DATABASE}"]
      interval: 10s
      timeout: 5s
      retries: 5

volumes:
  evolution_instances:
  evolution_redis:
  postgres_data:

networks:
  evolution-net:
    driver: bridge



### What is your environment?

Linux

### Other environment specifications

_No response_

### If applicable, paste the log output

_No response_

### Additional Notes

_No response_

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions