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

Source: StackOverflow