The essence of the problem:
I'm trying to make sure that my container with all services starts when Windows starts, but despite the fact that restart is everywhere: only phpmyadmin always starts when the system starts, while mysql and xampp just don't start for some reason (Docker Desktop logs are empty, there are no errors). If you run the container manually, then everything works like clockwork.
Clarifying information:
- OS - Windows
- I use WSL 2
- The project files are located in the file system of the ubuntu subsystem at the path /home
- Download and build a project from the ubuntu operating system using
docker compose up
anddocker-compose up --build
docker-compose.yml:
version: "3.9"
services:
php-app:
build:
context: .
dockerfile: Dockerfile
restart: always
volumes:
- ./src:/var/www/html
- ./apache/php.ini:/usr/local/etc/php/php.ini
depends_on:
- database-container
ports:
- 3000:80
database-container:
image: mysql:5.7
restart: always
environment:
MYSQL_ROOT_PASSWORD: mysql_pass
MYSQL_USER: test_user
MYSQL_DATABASE: mysql_db
MYSQL_PASSWORD: user_pass
volumes:
- ./mysql/myf:/etc/myf
- ./mysql/data:/var/lib/mysql:rw"
ports:
- "3306:3306"
phpmyadmin:
image: phpmyadmin:latest
restart: always
depends_on:
- database-container
links:
- database-container
ports:
- "3001:80"
environment:
PMA_HOST: database-container
MYSQL_ROOT_PASSWORD: mysql_pass
I realized that the problem is mounting docker volumes, but I can't figure out how to fix it.