1、添加国内镜像
现在很多docker镜像拉不到,需手动配置镜像源。
修改/etc/docker/daemon.json文件(如果没有手动新增)
{
"registry-mirrors":
[
"https://d9q4seay.mirror.aliyuncs.com",
"https://docker.m.daocloud.io",
"https://noohub.ru",
"https://huecker.io",
"https://dockerhub.timeweb.cloud"
]
}
2,docker-compose.yml
mysql:
image: 'mysql:8.0.27'
container_name: mysql
ports:
- 33066:3306
restart: always
environment:
MYSQL_ROOT_PASSWORD: 123456
volumes:
- /docker/data/mysql:/var/lib/mysql
- /docker/config/mysql:/etc/mysql/conf.d
- /docker/config/mysql/share/mysql-8.0:/etc/mysql/conf.d/share/mysql-8.0/