最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

windows - Docker Desktop restarts only part of the services in the container - Stack Overflow

matteradmin6PV0评论

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 and docker-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.

Post a comment

comment list (0)

  1. No comments so far