django.db.utils.OperationalError: (2002, “Can't connect to MySQL server on 'db' (115)”)

前端 未结 2 1607
滥情空心
滥情空心 2021-01-19 16:30

This has already been asked, but none of the answers have helped me. This is my configuration. Im running docker-compose with two services, a web app in django and the datab

相关标签:
2条回答
  • 2021-01-19 17:03

    your WEB containers starts before the DB is up and running , you need to wait for it using one of these methods or starting your DB first manually with docker-compose up db

    0 讨论(0)
  • 2021-01-19 17:14

    Make sure that your db docker image is running fine. Check the logs of the running db container. I am able to use MariaDB successfully in my docker-compose file :

    db:
    image: mariadb
    ports:
      - 3306:3306
    environment:
      MYSQL_USER: "****"
      MYSQL_PASSWORD: "****"
      MYSQL_DATABASE: "*****"
      MYSQL_RANDOM_ROOT_PASSWORD: "yes"
    
    0 讨论(0)
提交回复
热议问题