Answer the question
In order to leave comments, you need to log in
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"
web_1 | Waiting that SQL database is up...
Answer the question
In order to leave comments, you need to log in
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=%
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 questionAsk a Question
731 491 924 answers to any question