在学习go微服务时,用docker-compose启动nacos以及对应的mysql时出现上面的问题,
使用的yaml如下
version: "3.8"
services:nacos:image: nacos/nacos-server:${NACOS_VERSION}container_name: nacos-standalone-mysqlenv_file:- ../env/custom-application-config.envvolumes:- ./standalone-logs/:/home/nacos/logs- ./init.d/application.properties:/home/nacos/conf/application.propertiesports:- "8848:8848"- "9848:9848"depends_on:mysql:condition: service_healthyrestart: on-failuremysql:container_name: mysqlbuild:context: .dockerfile: ./image/mysql/5.7/Dockerfileimage: example/mysql:5.7env_file:- ../env/mysql.envvolumes:- ./mysql:/var/lib/mysqlports:- "3306:3306"healthcheck:test: [ "CMD", "mysqladmin" ,"ping", "-h", "localhost" ]interval: 5stimeout: 10sretries: 10
后续添加了镜像源https://docker.m.daocloud.io 就解决了
红色为新增的镜像源
"registry-mirrors": [
"https://docker.m.daocloud.io",
"https://ustc-edu-cn.mirror.aliyuncs.com",
"https://nrbewqda.mirror.aliyuncs.com",
"https://ccr.ccs.tencentyun.com",
"https://registry.docker-cn.com",
"https://mirror.ccs.tencentyun.com",
"https://registry.hub.docker.com"
]