U
U
user.2019-12-24 21:33:19
Docker
user., 2019-12-24 21:33:19

Service not starting in docker-compose?

Good evening,
There was a task to build a stack of the 'services' I need using docker-compose, I try it like this:

version: "3.1"

services:

  db:
    image: percona:latest
    container_name: myname.db
    restart: on-failure
    ports:
      - 127.0.0.150:3306:3306
    expose:
      - 3306
    environment:
      - MYSQL_ROOT_PASSWORD=rdkw1UDddqOEF4L1pmNkcyQ2oL
      - MYSQL_DATABASE=dolibarr
      - MYSQL_ROOT_HOST=%

  web:
    image: tuxgasy/dolibarr
    environment:
        DOLI_DB_HOST: mysql
        DOLI_DB_USER: root
        DOLI_DB_PASSWORD: rdkw1UDddqOEF4L1pmNkcyQ2oL
        DOLI_DB_NAME: dolibarr
        DOLI_URL_ROOT: 'http://127.0.0.1'
        PHP_INI_DATE_TIMEZONE: 'Europe/Paris'
    ports:
        - "81:80"

As a result, after execution I get:
docker-compose up
web_1 | Waiting that SQL database is up...

I see that the service from my DBMS does not start, I tried without ' link ' but the result is the same, this example has already been specially simplified (removed volumes and a couple of other services), I spent more than one hour but I don’t see the error point-blank, I will be very grateful if anyone it will tell you what's going on.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
I
Igor, 2019-12-24
@nekolov

Already repeatedly on this forum I advise the same config

# Database
  db:
    image: percona:latest
    container_name: myname.db
    restart: on-failure
    ports:
      - 127.0.0.150:3306:3306
    expose:
      - 3306
    environment:
      - MYSQL_ROOT_PASSWORD=rdkw1UDddqOEF4L1pmNkcyQ2oL
      - MYSQL_DATABASE=mydb
      - MYSQL_ROOT_HOST=%

Yes
And do not forget to throw out the previous one.
Thank you.

G
Georg Gaal, 2020-02-02
@gecube

Notes:
1. it is very reasonable to bring all services into one docker network and describe it explicitly (like this )
2. arrange helchecks
3. configure the startup order via depends_on
4. you need to figure out by what name the database service is available
DOLI_DB_HOST: mysql
should be
DOLI_DB_HOST: db

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question