1.建立稳定的repository:
yum install -y yum-utils
yum-config-manager\
--add-repo\
https://docs.docker.com/engine/installation/linux/repo_files/centos/docker.repo
yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
2.安装最新版本的docker
yum makecache fast
yum -y install docker-engine
systemctl start docker
docker version
3. pull centos镜像
--使用国内的docker仓库
echo "DOCKER_OPTS=\"\$DOCKER_OPTS --registry-mirror=http://f2d6cb40.m.daocloud.io\""
service docker restart
docker pull centos
3.2 使用dockerfile导入
docker build -t centos7.1 . (https://Git.oschina.Net/dockerf/docker-training/tree/master/centos7)
4.进入docker容器
--创建docker容器
docker run -d -p 8022:22 --name springcloud centos7.1:latest -p指定容器启动后docker上运行的端口映射及容器里运行的端口
进入docker容器
docker exec -it 835ab3ce33d1 /bin/bash
5.docker镜像拉取
https://hub.docker.com/search/
https://dev.aliyun.com/search.html
6.创建一个docker私有仓库(基于阿里docker)
https://blog.youkuaiyun.com/yelllowcong/article/details/78351307
http: server gave HTTP response to HTTPS client
https://www.cnblogs.com/lkun/p/7990466.html
查看仓库镜像
http://163.53.170.107:5000/v2/_catalog
仓库镜像的管理
https://www.cnblogs.com/Tempted/p/7768694.html
https://segmentfault.com/q/1010000006127473(重点)
7.多台主机中的docker容器网络服务互通
https://blog.youkuaiyun.com/blogzlh/article/details/80284141
8.docker容器不需要密码(以root用户登录)
docker exec -it --user root mysql5.6 /bin/bash