Home > Software design >  Why does Docker container keeps restarting? ERROR: getaddrinfo EAI_AGAIN
Why does Docker container keeps restarting? ERROR: getaddrinfo EAI_AGAIN

Time:04-29

This is my docker-compose.yml file

version: "3"
services:

  outline:
    image: outlinewiki/outline:latest
    restart: always
    command: sh -c "yarn sequelize:migrate --env=production-ssl-disabled && yarn start --env=production-ssl-disabled"
    env_file: ./docker.env
    ports:
      - "3000:3000"
    depends_on:
      - postgres
      - redis

  redis:
    image: redis
    restart: always
    env_file: ./docker.env
    ports:
      - "6379:6379"
    volumes:
      - ./redis.conf:/redis.conf
    command: ["redis-server", "/redis.conf"]

  postgres:
    image: postgres
    restart: always
    env_file: ./docker.env
    ports:
      - "5432:5432"
    volumes:
      - database-data:/var/lib/postgresql/data

volumes:
  database-data:

docker ps shows that redis and postgres are OK and that my outline app container is restarting

outlinewiki/outline:latest   "docker-entrypoint.s…"   2 minutes ago   Restarting (1) 20 seconds ago

Then I decided to check logs

ERROR: getaddrinfo EAI_AGAIN outline-wiki-db

error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
yarn run v1.22.18
$ sequelize db:migrate --env=production-ssl-disabled

Sequelize CLI [Node: 16.14.2, CLI: 6.3.0, ORM: 6.9.0]

Loaded configuration file "server/config/database.json".

I can not login into container.

Docker inspect shows

"Path": "docker-entrypoint.sh",
"Args": [
    "sh",
    "-c",
    "yarn sequelize:migrate --env=production-ssl-disabled && yarn start --env=production-ssl-disabled"
],

Why do I get ERROR: getaddrinfo EAI_AGAIN ?

CodePudding user response:

Based on the topic which has very similar issue to you, the application could not connect to the database.

This is only a wild guess but based on your error from logs:

ERROR: getaddrinfo EAI_AGAIN outline-wiki-db

I would assume you are trying to connect to the database with outline-wiki-db name, which would in your case be wrong. Based on your compose I would assume it needs to try to connect to postgres instead.

  • Related