I m 从事基于Debian的虚拟方框工作
我有 do子-comp子:
version: 3
services:
mydb:
build: ./db/
networks:
- dockercompose-frontend
volumes:
- server_db:/var/lib/mysql
environment:
- MYSQL_ROOT_PASSWORD=debian
healthcheck:
test: ["CMD", "mariadb-admin", "ping", "-h", "localhost"]
interval: 10s
timeout: 15s
retries: 5
frontend:
build: .
ports:
- "8080:80"
networks:
- dockercompose-frontend
environment:
PMA_HOST=mydb
PMA_PORT=3306
volumes:
server_db:
driver: local
networks:
dockercompose-frontend:
两台Dockerfiles供每个部门使用,我刚刚安装必要的图像。
FROM mariabd:latest
RUN apt-get update && apt-get install -y iputils-ping
以及
FROM phpmyadmin:5.2.0-apache
RUN apt-get update && apt-get install -y iputils-ping
当使用<条码>的Im cker 堆肥料成条码>时(无――d方式):
frontend-1 | AH00558: apache2: Could not reliably determine the server s fully qualified domain nam e, using 172.25.0.2. Set the ServerName directive globally to suppress this message
When I m using docker compose up -d
以及 checks Health State for mydb it throws:
{
"Status":"starting",
"FailingStreak": 2,
"Log": [{"Start": "2024-02-19T10:05:48.178379963-05:00",
"End": 2024-02-19T10:05:48.240662846-05:00",
"ExitCode": 1,
"Output":"u0007mariadb-admin: connect to server a t localhost failed
error: Can t connect to local server through socket /run/mysqld/mysqld.sock (2)
Check that mariadbd is running 以及 that the socket: /run/mysqld/mysqld.sock exists!"
}
此外,
docker exec dockercompose-mydb-1 service mariadb status
投掷“Mariadb服务被停止”
之后
docker exec dockercompose-mydb-1 service mariadb start
它投掷了第1条(航行)。