如果docker-compose文件不在当前路径的下一级:
go
PS D:\code\GoLandProject\oneProject> docker compose up
no configuration file provided: not found
需要指定配置文件路径:
go
PS D:\code\GoLandProject\oneProject> docker compose -f script/docker-compose.yaml up
[+] Running 1/1
✔ Container script-mysql8-1 Recreated
或者直接在例子中的script目录执行
go
PS D:\code\GoLandProject\oneProject\script> docker compose up
[+] Running 1/0
✔ Container script-mysql8-1 Created
看到ready for connections.即为成功
go
[Server] /usr/sbin/mysqld: ready for connections. Version: '8.0.29' socket: '/va
r/run/mysqld/mysqld.sock' port: 3306 MySQL Community Server - GPL.