0

docker create network didn't work I tried reinstall docker, mysql too but after those, still it happens

once it worked somehow after running prune something and changing docker-compose.yml like this

networks:
  mysql8:
    external: true

but now it doesn't work again and shows the error below

error image here

when I run docker-compose up, the error messages appear like this after running docker system prune --all

[+] Running 13/13
 ⠿ mysql8 Pulled                                                                               27.7s
   ⠿ f7ec5a41d630 Pull complete                                                                 7.2s
   ⠿ 9444bb562699 Pull complete                                                                 7.3s
   ⠿ 6a4207b96940 Pull complete                                                                 7.5s
   ⠿ 181cefd361ce Pull complete                                                                 7.7s
   ⠿ 8a2090759d8a Pull complete                                                                 7.8s
   ⠿ 15f235e0d7ee Pull complete                                                                 8.7s
   ⠿ d870539cd9db Pull complete                                                                 8.7s
   ⠿ 5726073179b6 Pull complete                                                                 8.8s
   ⠿ eadfac8b2520 Pull complete                                                                22.4s
   ⠿ f5936a8c3f2b Pull complete                                                                22.5s
   ⠿ cca8ee89e625 Pull complete                                                                22.5s
   ⠿ 6c79df02586a Pull complete                                                                22.6s
network mysql8 declared as external, but could not be found

and shows only the last message network mysql8 declared as external, but could not be found for docker-compose up

Booski
  • 1
  • 1
  • Could you post your full `docker-compose.yml`? – Graham Laming Oct 04 '22 at 14:35
  • ` version: "3.1" services: mysql8: container_name: mysql8 image: mysql:8.0.23 platform: linux/x86_64 volumes: - db_data:/var/lib/mysql restart: always command: mysqld --default-authentication-plugin=mysql_native_password --lower_case_table_names=0 --transaction-isolation=READ-COMMITTED environment: MYSQL_ROOT_PASSWORD:** ports: - 3306:3306 networks: - mysql8 networks: mysql8: name: mysql8 external: true volumes: db_data: ` why does this look so ugly hah – Booski Oct 04 '22 at 14:46
  • 1
    please put all relevant details in the question - any text such as erorr messages should be pasted as text, not as a screenshot – erik258 Oct 04 '22 at 16:06
  • Do you require the manually-declared network? Does your setup work if you delete all of the `networks:` blocks in the whole file? – David Maze Oct 04 '22 at 16:51
  • @DavidMaze when I block the network part, it shows `Error response from daemon: Ports are not available: exposing port TCP 0.0.0.0:3306 -> 0.0.0.0:0: listen tcp 0.0.0.0:3306: bind: address already in use` so I killed the working pid but mysql8 doesn't get killed and appears again and again with another pid and shows the same message – Booski Oct 05 '22 at 13:14
  • [Docker Error bind: address already in use](https://stackoverflow.com/questions/37971961/docker-error-bind-address-already-in-use) discusses that error. The first `3306` in your `ports:` conflicts with another MySQL server, either in a different container with a similar `ports:` line or running outside Docker entirely. Change the port number (only the first one, the second needs to stay at `3306`), or remove the `ports:` block, or stop the other database. – David Maze Oct 05 '22 at 13:36
  • (That published-ports mechanism is separate from Docker's networking subsystem; you will have the same error whatever Docker network your containers are attached to. I'd recommend usually using the Compose-provided `default` network for simplicity.) – David Maze Oct 05 '22 at 13:37

0 Answers0