Docker技术实践
centos7 安装 docker17.03.2
采用国内阿里云安装
# Set up repository
sudo yum install -y yum-utils device-mapper-persistent-data lvm2
# Use Aliyun Docker
sudo yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
# 不指定版本号 默认安装最新版
sudo yum install docker-ce
安装结果如图
启动docker
# Start docker service
systemctl enable docker
systemctl start docker
# 重新加载设置 重启引擎
systemctl daemon-reload
systemctl restart docker
可见能够正常启动docker
运行Helloworld
执行run hello world
docker run hello-world
运行ubuntu镜像
执行命令
docker run -it ubuntu bash
成功的安装并运行了ubuntu镜像
尝试输入指令成功
显示docker信息
本地镜像库内容
运行中的docker信息
显示所有容器
Mysql镜像
首先下载对应的镜像
创建文件dockfile
FROM ubuntu
ENTRYPOINT ["top", "-b"]
CMD ["-c"]
构建镜像
运行镜像
启动服务器
启动客户端
查看sql数据库文件
查看卷
创建卷并挂载
启动客户端并链接到服务器