Docker swarm php-fpm container keeps restarting - php

I created a basic LAPP stack which runs flawlessly on localhost with docker-compose. When I try to make it run with Swarm on production server (1 manager only, no workers), all services go up and get replicated (1/1) but the php-fpm one which keeps restarting with no apparent error.
docker service ls
ID NAME MODE REPLICAS IMAGE PORTS
p0rdrdfmso6x traefik_reverse-proxy replicated 1/1 traefik:v2.4 *:80->80/tcp, *:443->443/tcp
e6vwlo9iw2ny my_stack_apache replicated 1/1 apache:latest *:8000->80/tcp
qy5yigbcjryr my_stack_ftp replicated 1/1 fauria/vsftpd:latest *:20-21->20-21/tcp, *:22100-22110->22100-22110/tcp
n5f9v6bd2854 my_stack_php replicated 0/1 php:latest
rcnbq4vnoz1j my_stack_postgres replicated 1/1 postgres:9.5.24
If we focus on php-fpm container :
docker service ps my_stack_php
ID NAME IMAGE NODE DESIRED STATE CURRENT STATE ERROR PORTS
j6mp3ka40cyo my_stack_php.1 php:latest node.address Ready Ready 2 seconds ago
ezztpsjoglwy \_ my_stack_php.1 php:latest node.address Shutdown Complete 3 seconds ago
gnqjhwpi5y72 \_ my_stack_php.1 php:latest node.address Shutdown Complete 9 seconds ago
0agr3tw0bb9g \_ my_stack_php.1 php:latest node.address Shutdown Complete 15 seconds ago
9a6wsdp4tqqn \_ my_stack_php.1 php:latest node.address Shutdown Complete 21 seconds ago
If I look to the logs :
docker service logs my_stack_php
my_stack_php.1.igd8x7a6ysdi#node.address | Interactive shell
my_stack_php.1.57td5iuk1wwy#node.address | Interactive shell
my_stack_php.1.r03jn931l1uf#node.address | Interactive shell
my_stack_php.1.igd8x7a6ysdi#node.address |
my_stack_php.1.r03jn931l1uf#node.address |
my_stack_php.1.1huf2pdd0bq0#node.address | Interactive shell
my_stack_php.1.57td5iuk1wwy#node.address |
my_stack_php.1.1huf2pdd0bq0#node.address |
It behaves like a container running a command which would end with succes in a few seconds. Swarm launches then an new container to keep the restart contract. However, my php-fpm Dockerfile provide the -F argument that should keep the process running :
PHP Dockerfile
FROM centos:7.4
# ... all installs from Centos to add PHP 7.2 from Remi Collet repositories
RUN mkdir -p /run/php-fpm
RUN usermod -a -G ftp apache
WORKDIR /var/www/html
EXPOSE 9000
# Run in foreground as root (in container POV)
CMD ["php-fpm", "-R", "-F"]
docker-compose.yaml
version: '3.9'
services:
postgres:
image: "postgres:9.5.24"
environment:
POSTGRES_DB: /run/secret/postgres_db
POSTGRES_USER: /run/secret/postgres_user
POSTGRES_PASSWORD: /run/secret/postgres_password
volumes:
- database:/var/lib/postgresql/data
secrets:
- postgres_db
- postgres_user
- postgres_password
deploy:
resources:
limits:
cpus: '0.15'
memory: 128m
networks:
- internal
apache:
env_file: .env
image: apache:latest
build:
context: ./docker/images/apache2.4
dockerfile: prod.Dockerfile
ports:
- 8000:80
environment:
FPM_HOST: php:9000
volumes:
- ./docker/logs/apache/:/var/log/httpd/
networks:
- traefik-public
- internal
deploy:
labels:
- "traefik.enable=true"
- "traefik.http.routers.my_stack.rule=Host(`my-host.com`)"
- "traefik.http.routers.my_stack.entrypoints=websecure"
- "traefik.http.routers.my_stack.tls.certresolver=letsencryptresolver"
- "traefik.http.services.my_stack.loadbalancer.server.port=80"
- "traefik.port=80"
resources:
limits:
cpus: '0.15'
memory: 128m
php:
env_file: .env
image: php:latest
# links:
# - ftp
# - apache
build:
context: ./docker/images/php
dockerfile: prod.Dockerfile
# args:
# TIMEZONE: 'Europe/Paris'
volumes:
- ftp_data:/var/www/ftp:rw
networks:
- internal
deploy:
resources:
limits:
cpus: '0.20'
memory: 512m
ftp:
env_file: .env
image: "fauria/vsftpd:latest"
ports:
- "20:20"
- "21:21"
- "22100-22110:22100-22110"
environment:
FTP_USER: apache
FTP_PASS: /run/secret/automation_client_password
PASV_ADDRESS: 127.0.0.1
PASV_MIN_PORT: 22100
PASV_MAX_PORT: 22110
volumes:
- ftp_data:/home/vsftpd/apache:rw
networks:
- traefik-public
- internal
deploy:
resources:
limits:
cpus: '0.15'
memory: 128m
volumes:
ftp_data:
database:
secrets:
postgres_db:
external: true
postgres_user:
external: true
postgres_password:
external: true
automation_client_password:
external: true
networks:
traefik-public:
external: true
internal:
external: false
Anyone got a clue about this? Any helps/tips will be appreciated.

I don't like this kind of answer, but replica's all went live after complete reboot.

Related

PHP-FPM docker container got different behavior depending engine (docker-compose and swarm)

One PHP-FPM container (7.2), member of classical LAPP stack, correctly exposes port 9000 when launched with docker-compose but nothing when started by Docker Swarm. Should I mention that container is running (see output below) and I can launch a TTY bash on it.
So with docker-compose, web application is fully functionnal, but with Swarm, Apache issues a 503 Service Unavailable. Nothing is changed between tests with different engines. Do you have any clue about this behaviour ?
docker-compose.yml
version: '3.5'
services:
postgres:
env_file: ./.env
image: "postgres:9.5.24"
volumes:
- database:/var/lib/postgresql/data
networks:
- internal
adminer:
image: adminer
networks:
- internal
- traefik-public
deploy:
labels:
- "traefik.enable=true"
- "traefik.http.routers.adminer.rule=Host(`adminer.example.com`)"
- "traefik.http.routers.adminer.entrypoints=websecure"
- "traefik.http.routers.adminer.tls.certresolver=letsencryptresolver"
- "traefik.http.services.adminer.loadbalancer.server.port=8080"
- "traefik.port=80"
apache:
env_file: ./.env
image: visio_rdv_apache:latest
build:
context: docker/images/apache2.4
dockerfile: Dockerfile
args:
UID: ${HOST_UID}
ROOT_URL: ${ROOT_URL}
ports:
- 8000:80
environment:
FPM_HOST: php:9000
ROOT_URL: ${ROOT_URL}
volumes:
- ${LOGS_DIR}/apache/:/var/log/httpd/
- ${RELATIVE_APP_PATH}:/var/www/html
links:
- postgres
- php
networks:
- internal
- traefik-public
deploy:
labels:
- "traefik.enable=true"
- "traefik.http.routers.visio_rdv.rule=Host(`test.example.com`)"
- "traefik.http.routers.visio_rdv.entrypoints=websecure"
- "traefik.http.routers.visio_rdv.tls.certresolver=letsencryptresolver"
- "traefik.http.services.visio_rdv.loadbalancer.server.port=80"
- "traefik.port=80"
php:
env_file: .env
links:
- ftp
image: visio_rdv_php:latest
build:
context: docker/images/php
dockerfile: Dockerfile
args:
UID: ${HOST_UID}
TIMEZONE: ${TIMEZONE}
PROXY: ${http_proxy}
volumes:
- ftp_data:/var/www/ftp:rw
- ${RELATIVE_APP_PATH}:/var/www/html
networks:
- internal
ftp:
env_file: .env
image: "fauria/vsftpd:latest"
ports:
- "9520:20"
- "9521:21"
- "21100-21110:21100-21110"
environment:
FTP_USER: ${FTP_USER}
FTP_PASS: ${FTP_PASS}
PASV_MIN_PORT: 21100
PASV_MAX_PORT: 21100
volumes:
- ftp_data:/home/vsftpd/${AUTOMATION_CLIENT_NAME}:rw
networks:
- internal
volumes:
ftp_data:
database:
networks:
traefik-public:
external: true
internal:
external: false
With Docker Swarm
Apache logs :
[Wed Aug 04 07:35:16.382246 2021] [proxy:error] [pid 11] (111)Connection refused: AH00957: FCGI: attempt to connect to 10.0.4.93:9000 (*) failed
[Wed Aug 04 07:35:16.382314 2021] [proxy_fcgi:error] [pid 11] [client 10.0.0.2:1035] AH01079: failed to make connection to backend: php, referer: http://test.example.com/
Swarm services list :
docker service ls
ID NAME MODE REPLICAS IMAGE PORTS
um2txtpz8534 traefik_reverse-proxy replicated 1/1 traefik:v2.4
ahf7uukapxbr my_stack_adminer replicated 1/1 adminer:latest
ue8qekmg0ff0 my_stack_apache replicated 1/1 my_stack_apache:latest my_stack*:8000->80/tcp
x9igaslhsx11 my_stack_ftp replicated 1/1 fauria/vsftpd:latest *:9520-9521->20-21/tcp, *:21100-21110->21100-21110/tcp
jpk4qzqs1tfx my_stack_php replicated 1/1 my_stack_php:latest
ih67rh82vp9e my_stack_postgres replicated 1/1 postgres:9.5.24
I tried to add net-tools to the PHP image, in order to manually test the connection with nc. Same result, php container instance IP is correctly resolved, but any TCP connection to port 9000 is refused.
I use a lot environment vars, and in order to palliate missing feature with Swarm, I use the docker-compose config command output to generate complete docker-compose.yml file.
With docker-compose
Name Command State Ports
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
my_stack_adminer_1 entrypoint.sh docker-php-e ... Up 8080/tcp
my_stack_apache_1 /bin/sh -c apachectl -D FO ... Up 0.0.0.0:8000->80/tcp
my_stack_ftp_1 /usr/sbin/run-vsftpd.sh Up 0.0.0.0:9520->20/tcp, 0.0.0.0:9521->21/tcp, 0.0.0.0:21100->21100/tcp, 0.0.0.0:21101->21101/tcp, 0.0.0.0:21102->21102/tcp,
0.0.0.0:21103->21103/tcp, 0.0.0.0:21104->21104/tcp, 0.0.0.0:21105->21105/tcp, 0.0.0.0:21106->21106/tcp, 0.0.0.0:21107->21107/tcp,
0.0.0.0:21108->21108/tcp, 0.0.0.0:21109->21109/tcp, 0.0.0.0:21110->21110/tcp
my_stack_php_1 php-fpm -R -F Up 9000/tcp
my_stack_postgres_1 docker-entrypoint.sh postgres Up 5432/tcp
Here are a few things I'd try:
Use docker service inspect to see if the configuration matches what you expect it to be.
Jump into the php container and see what port it's actually listening on.
Did you intend to expose the apache server directly? I would imagine you'd use traefik in front of that since you already have in the mix.

Docker PHP7.x Codeception Selenium WebDriver throws net::ERR_CONNECTION_REFUSED

I am trying to set up Codeception to do Acceptance and Functional testing for my web app. Below are my files:
docker-compose.yml
version: '3.7'
services:
# nginx - web server
nginx:
build:
context: ./docker-config/nginx
dockerfile: ./Dockerfile
env_file: &env
- ./cms/.env
init: true
ports:
- "8000:80"
volumes:
- cpresources:/var/www/project/cms/web/cpresources
- ./cms/web:/var/www/project/cms/web:cached
networks:
mmc-network:
aliases:
- mmc.nginx
# php - run php-fpm
php:
build: &php-build
context: ./docker-config/php-prod-craft
dockerfile: ./Dockerfile
depends_on:
- "mysql"
- "redis"
env_file:
*env
expose:
- "9000"
init: true
volumes: &php-volumes
- some volumes............
networks:
mmc-network:
aliases:
- mmc.php
# mysql - database
mysql:
build:
context: ./docker-config/mysql
dockerfile: ./Dockerfile
cap_add:
- SYS_NICE # CAP_SYS_NICE
env_file:
*env
environment:
MYSQL_ROOT_PASSWORD: secret
MYSQL_DATABASE: project
MYSQL_USER: project
MYSQL_PASSWORD: project
init: true
ports:
- "3306:3306"
volumes:
- db-data:/var/lib/mysql
- ./db-seed/:/docker-entrypoint-initdb.d
networks:
- MMC-network
# redis - key/value database for caching & php sessions
redis:
build:
context: ./docker-config/redis
dockerfile: ./Dockerfile
expose:
- "6379"
init: true
networks:
- mmc-network
# webpack - frontend build system
webpack:
build:
context: ./docker-config/node-dev-webpack
dockerfile: ./Dockerfile
env_file:
*env
init: true
ports:
- "8080:8080"
volumes:
- some volumes..........
networks:
- mmc-network
# selenium - web driver for codeception testing
selenium:
container_name: mmc-selenium
ports:
- "4444:4444"
volumes:
- ./cms:/data
build:
context: ./docker-config/selenium
dockerfile: ./Dockerfile
networks:
mmc-network:
aliases:
- mmc.selenium
volumes:
db-data:
cpresources:
storage:
networks:
mmc-network:
acceptance.suite.dist.yml:
actor: AcceptanceTester
extensions:
enabled:
- Codeception\Extension\RunFailed
- Codeception\Extension\Recorder
modules:
error_level: "E_ALL"
enabled:
- WebDriver:
url: 'http://mmc.nginx'
host: mmc.selenium
port: '4444'
window_size: 1920x1200
browser: 'chrome'
wait: 60
capabilities:
os: Windows
os_version: 10
browserstack.local: true
- \Helper\Acceptance
NavigationCept.php
<?php
$I = new AcceptanceTester($scenario);
# define purpose of the test
$I->wantTo("check that navigation is functional.");
# check all menu items
$I->amOnPage('/');
$I->see('Search');
***Now, point to be noted, Codeception is already installed inside my PHP container and working perfectly.
When I try to run the test, I get the below error which indicates that the connection to my host (which is my Nginx server) has been refused.
I tried with a different url, for example, https://google.com and it just connected fine and everything was successful. Am I doing something wrong in here? Is my url param incorrect? Please help me out if you can. Thanks in advance.
I have seen such exception earlier with Codeception + Selenium. I do not have that project config file to share with you though.
My strong guess here is this error could be due to conflicts around Codeception-ChromeDriver-Selenium versions
Have you tried to execute this on a lower ChromeDriver version say 80 or 75?
Or change the Selenium version?
You could review the following notes which may help you debug this more
https://github.com/Codeception/Codeception/issues/5062
https://stackoverflow.com/a/63760572/2923098
Will update this answer if I find other resources to resolve this.
Docker service are reachable from each other using the service name as hostname. So your configuration could be:
enabled:
- WebDriver:
url: 'http://nginx'
host: selenium
port: '4444'
An alias to a service could be specified at another service as:
selenium:
links:
- "nginx:mmc.nginx"
Then the url could be url: 'http://mmc.nginx'
Workaround: use service IP address
enabled:
- WebDriver:
url: 'http://172.18.0.3'
host: 172.18.0.2
port: '4444'
Test setup using busybox:
docker-compose.yaml that runs 2 dummy web servers with netcat utility for demonstration purposes.
version: '3.7'
services:
nginx:
container_name: mmc-nginx
hostname: mmc-nginx
image: busybox
command: ["sh", "-c", "while true ; do (echo -e 'HTTP/1.1 200 OK\r\nConnection: Close\r\nContent-type: application/xml\r\n\r\n'; echo 'response from '`hostname`':80') | nc -l -p 80 ;done" ]
init: true
ports:
- "8000:80"
networks:
- mmc-network
# selenium - web driver for codeception testing
selenium:
container_name: mmc-selenium
hostname: mmc-selenium
command: ["nc", "-l", "-p", "4444"]
ports:
- "4444:4444"
image: busybox
networks:
- mmc-network
networks:
mmc-network:
name: mmc-network
test command:
docker exec -it mmc-selenium wget -q "http://mmc-nginx" -O -
docker exec -it mmc-selenium wget -q "http://172.18.0.3" -O -
Response:
response from mmc-nginx:80
Access from outside docker network:
wget -q "http://localhost:8000" -O -
response from mmc-nginx:80
Ping to mmc-nginx
docker exec -it mmc-selenium ping -c2 mmc-nginx
PING mmc-nginx (172.18.0.3): 56 data bytes
64 bytes from 172.18.0.3: seq=0 ttl=64 time=0.071 ms
64 bytes from 172.18.0.3: seq=1 ttl=64 time=0.111 ms
--- mmc-nginx ping statistics ---
2 packets transmitted, 2 packets received, 0% packet loss
round-trip min/avg/max = 0.071/0.091/0.111 ms
Find service IP address:
Using docker. Change svc value accordingly.:
svc='friendly_solomon' docker inspect -f '{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}' "$svc"
Using jq. Change svc value accordingly. jq is a great json processing tool to have btw.
svc='mmc-nginx'; docker network inspect bridge | jq -r --arg svc "$svc" '.[] | .Containers | .[] | select(.Name == $svc) | .IPv4Address'
Using grep
svc='mmc-nginx' docker network inspect bridge | grep -A5 "$svc" | grep 'IPv4Address

PhpStorm + Docker for mac. Does not assign a port

My docker-compose file:
version: '3.8'
services:
cache:
image: memcached:latest
restart: always
ports:
- "10001:11211"
server:
build: '.'
tty: true
working_dir: /var/www
environment:
DISABLE_DEFAULT_SERVER: 1
AUTORELOAD_PROGRAMS: "kid_api"
AUTORELOAD_ANY_FILES: 1
volumes:
- ../../Apps/Server:/var/www
- ./php/config/custom.ini:/usr/local/etc/php/conf.d/custom.ini
- ./supervisor/kid_api.conf:/etc/supervisor/service.d/kid_api.conf
ports:
- "9988:9988"
depends_on:
- cache
links:
- cache
My Api.php file into /var/www open socket port for daemon server with Swoole.
When i tried docker-compose up, then ports is ok:
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
4c80bee2baf7 php74_swoole4510_base_server "/entrypoint.sh" 2 hours ago Up 1 second 0.0.0.0:9988->9988/tcp php74_swoole4510_base_server_1
3b0f67cc3295 memcached:latest "docker-entrypoint.s…" 24 hours ago Up 2 hours 0.0.0.0:10001->11211/tcp php74_swoole4510_base_cache_1
but if i tried to run with PhpStorm
then the ports are not open
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
a7b534100202 php74_swoole4510_base_server "php /var/www/Api.php" 2 seconds ago Up Less than a second php74_swoole4510_base_server_run_df9a640e18bb
3b0f67cc3295 memcached:latest "docker-entrypoint.s…" 24 hours ago Up 2 minutes 0.0.0.0:10001->11211/tcp php74_swoole4510_base_cache_1
How fix it?
docker-compose up is not equivalent to docker-compose run.
PhpStorm does docker-compose run service_name command.
Docker Compose itself doesn't map ports in this case, you can check it in the terminal.
You can spin up the services with docker-compose up in the terminal manually, and then use PhpStorm in the exec mode (the option is visible on your screenshot).

Why docker not syncing files inside container on Windows 10?

I have issue after last docker update (seems so) on Windows 10 (local development). When I changed files in PhpStorm (and in another editors - Sublime, Notepad+), after a while, files inside container didn't receive changes.
Steps that can help for a while:
If I completely shut down all containers and after that arise them again. docker-compose down && docker-compoes up
If I get into php-fpm container and for file that not changed ran touch file.php (this file will be immidiatly changed).
What I tried and it didn't help:
I restarted php-fpm and nginx containers docker-compose restart php-fpm nginx (Yes it's strange, because down|up for all container helped)
I changed inside PhpStorm setting Use Safe write(save changes for temporary file first)
Also I checked inode for file inside container. With ls -lai file.php. Before changes worked and after they broked I had the same inode number. There is no determined number of changes I must to do to break syncing, it's random, sometime 2 changes enough.
I have:
Docker version 19.03.5, build 633a0ea
docker-compose version 1.25.2, build 698e2846
docker-compose.yml
version: '3'
services:
nginx:
container_name: pr_kpi-nginx
build:
context: ./
dockerfile: docker/nginx.docker
volumes:
- ./:/var/www/kpi
- ./docker/nginx/default.conf:/etc/nginx/conf.d/default.conf
- ./docker/nginx/fastcgi.conf:/etc/nginx/fastcgi.conf
ports:
- "8081:80"
links:
- php-fpm
networks:
- internal
php-fpm:
container_name: pr_kpi-php-fpm
build:
context: ./
dockerfile: docker/php-fpm.docker
volumes:
- ./:/var/www/kpi
links:
- kpi-mysql
environment:
# 192.168.221.1 -> host.docker.internal for Mac and Windows
XDEBUG_CONFIG: "remote_host=host.docker.internal remote_enable=1"
PHP_IDE_CONFIG: "serverName=Docker"
networks:
- internal
mailhog:
container_name: pr_kpi-mailhog
image: mailhog/mailhog
restart: always
ports:
# smtp
- "1025:1025"
# http
- "8025:8025"
networks:
- internal
kpi-mysql:
container_name: pr_kpi-kpi-mysql
image: mysql:5.7
command: mysqld --sql_mode="STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"
volumes:
- ./docker/storage/kpi-mysql:/var/lib/mysql
environment:
# We must change prod secrets, this is not good approach
- "MYSQL_ROOT_PASSWORD=pass"
- "MYSQL_USER=user"
- "MYSQL_PASSWORD=user_pass"
- "MYSQL_DATABASE=kpi_db"
ports:
- "33061:3306"
networks:
- internal
kpi-npm:
container_name: pr_kpi-npm
build:
context: ./
dockerfile: docker/npm.docker
volumes:
- ./:/var/www/kpi
- /var/www/kpi/admin/node_modules
ports:
- "4200:4200"
networks:
- internal
tty: true
# For xdebug
networks:
internal:
driver: bridge
ipam:
driver: default
config:
- subnet: 192.168.221.0/28
P.S. There is opened issue:
https://github.com/docker/for-win/issues/5530
P.P.S. We need to update Docker from 2.2.0.0 to 2.2.0.3, Seems it's fixed
I have a separate container for syncing my folder:
app:
image: httpd:2.4.38
volumes:
- ./:/var/www/html
command: "echo true"
I just use the basic apache image, you could use anything really though. Then in my actual containers, I use the following volumes_from key:
awesome.scot:
build: ./build/httpd
links:
- php
ports:
- 80:80
- 443:443
volumes_from:
- app
php:
build: ./build/php
ports:
- 9000
- 9001
volumes_from:
- app
links:
- mariadb
- mail
environment:
APPLICATION_ENV: 'development'
I've never had an issue using this set up, files always sync fast, and I have tested both on Mac OSX and MS Windows.
If you're interested, here is my full LAMP stack on Github https://github.com/delboy1978uk/lamp
I have the same issue on Windows10 since 31st Jan.
I have commented a line in PhpStorm and checked it in the container using vim.
The changes were not there.
If I run docker-compose down and up, the changes go in the container.
Docker version 19.03.5, build 633a0ea
docker-compose version 1.25.4, build 8d51620a
Nothing changed in my docker-compose.yml since 2018.

Mysql Exited on Docker Container

I want to make a web development platform on MacOS by using Docker. I installed nginx, and php7-fpm container and they're running and communicating each other. But after installing mysql container, mysql container was exited. I don't know why it exited.
This is docker ps -a output:
2955d2d5c392 nginx "/sbin/my_init" 38 seconds ago Up 36 seconds 0.0.0.0:8080->80/tcp dockertutorial_web_1
ec3c16795f05 php:7-fpm "docker-php-entrypoin" 38 seconds ago Up 37 seconds 9000/tcp dockertutorial_php_1
835e91ba927a mysql:latest "docker-entrypoint.sh" 38 seconds ago Exited (0) 37 seconds ago dockertutorial_mysql_1
As you can see, mysql was exited.
This is my docker-compose.yml file:
web:
image: nginx
ports:
- "8080:80"
volumes:
- ./src/public:/var/www/public
- ./src/vhost.conf:/etc/nginx/sites-enabled/vhost.conf
links:
- php
php:
image: php:7-fpm
volumes:
- ./src/public:/var/www/public
links:
- mysql
mysql:
image: mysql:latest
ports:
- "3306:3306"
volumes:
- /var/lib/mysql
command: "true"
environment:
MYSQL_ROOT_PASSWORD: secret
MYSQL_DATABASE: project
MYSQL_USER: project
MYSQL_PASSWORD: project
Any suggesstion to solve it?
You are overriding command for MySQL image with true which will be run instead of mysqld.
Remove command: "true" from docker-compose.yml from mysql service and it will start mysqld.
See this Dockerfile for reference.
https://github.com/docker-library/mysql/blob/c207cc19a272a6bfe1916c964ed8df47f18479e7/5.7/Dockerfile#L63

Categories