初学者文档:菜鸟教程


 

  1. Dockerfile 最佳实践icon-default.png?t=M4ADhttps://docs.docker.com/develop/develop-images/dockerfile_best-practices/

1,docker给镜像打标签

sudo docker tag [ImageId] ccr.ccs.tencentyun.com/olddriver/respository:[tag]

2,推送到镜像仓库

sudo docker push ccr.ccs.tencentyun.com/olddriver/respository:[tag]

3,docker启动mysql:

命令    解释
docker run -p 3306:3306 --name mysql \启动mysql容器,映射端口,换行
-v /usr/local/docker/mysql/conf:/etc/mysql \设置配置文件数据卷(映射配置目录)
-v /usr/local/docker/mysql/logs:/var/log/mysql \设置日志文件数据卷
-v /usr/local/docker/mysql/data:/var/lib/mysql \设置数据文件数据卷
-e MYSQL_ROOT_PASSWORD=666666 \设置数据库访问root密码
-d mysql:tag镜像名称:镜像仓库:镜像Tag

例子:

docker run -p 3306:3306 --name mysql
-v /usr/local/docker/mysql/conf:/etc/mysql
-v /usr/local/docker/mysql/logs:/var/log/mysql
-v /usr/local/docker/mysql/data:/var/lib/mysql
-e MYSQL_ROOT_PASSWORD=root
-d mysql:5.7.22

Logo

权威|前沿|技术|干货|国内首个API全生命周期开发者社区

更多推荐