简体   繁体   中英

Docker Issue - WordPress site does not run on localhost

I used docker for a WordPress project. In the beginning project worked fine, No Issue. However, after 4 days when I return to project it did not work. Steps I followed.

  1. I run the docker
  2. then I try to load the site on localhost with port 8000, It did not load
  3. There was following errors

ERROR: for WordPress_tob_db_1 Cannot start service db: network b3449fecdd40aedf6mo1485bd7e4ec5hu4aef451a4f95c97c9375e74fbbee436 not found

ERROR: for db Cannot start service db: network b3449fecdd40aedf6mo1485bd7e4ec5hu4aef451a4f95c97c9375e74fbbee436 not found

ERROR: Encountered errors while bringing up the project.

I created new separate WordPress project and it worked fine but once I stopped the docker and run it again the same errors received mentioned above in points.

I did search to find the solution but couldn't find to fix the issue.

Docker is running on Windows 10 Operating System and following code is belong to docker-compose.yaml

version: '3'
services:
  # Database
  db:
    image: mysql:5.7
    volumes:
      - db_data:/var/lib/mysql
    restart: always
    environment:
      MYSQL_ROOT_PASSWORD: password
      MYSQL_DATABASE: wordpress
      MYSQL_USER: wordpress
      MYSQL_PASSWORD: wordpress
    networks:
      - wpsite
  # phpmyadmin
  phpmyadmin:
    depends_on:
      - db
    image: phpmyadmin/phpmyadmin
    restart: always
    ports:
      - '8080:80'
    environment:
      PMA_HOST: db
      MYSQL_ROOT_PASSWORD: password 
    networks:
      - wpsite
  # Wordpress
  wordpress:
    depends_on:
      - db
    image: wordpress:latest
    ports:
      - '8000:80'
    restart: always
    volumes: ['./:/var/www/html']
    environment:
      WORDPRESS_DB_HOST: db:3306
      WORDPRESS_DB_USER: wordpress
      WORDPRESS_DB_PASSWORD: wordpress
    networks:
      - wpsite
networks:
  wpsite:
volumes:
  db_data:

Any help to solve this issue would be appreciated.

Thanks

只需将 docker 切换到 Linux 容器,因为 MySQL 映像是为 Linux 设计的,而不是为 Windows 设计的

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM