Docker初学Centos7下Docker-ce的安装
小提示:关于内核版本问题 本人使用centos7.2内核是3.10的创建镜像时候出现了错误提示:
docker: Error response from daemon: OCI runtime create failed: container_linux.go:344: starting container process caused "process_linux.go:293: copying bootstrap data to pipe caused \"write init-p: broken pipe\"": unknown
这个是因为内核版本的问题,升级内核即可或是降docker的版本看自己需求了(自行百度或是google)升级内核可参考:https://rorschachchan.github.io/2018/06/11/%E9%98%BF%E9%87%8C%E4%BA%91centos7%E5%8D%87%E7%BA%A7%E5%86%85%E6%A0%B8%E8%BF%87%E7%A8%8B/

安装:
wget https://mirrors.tuna.tsinghua.edu.cn/docker-ce/linux/centos/docker-ce.repo -O /etc/yum.repos.d/docker-ce.repo
使用清华大学开源软件镜像
sed -i 's#https://download.docker.com/#https://mirrors.tuna.tsinghua.edu.cn/docker-ce/#g' /etc/yum.repos.d/docker-ce.repo
yum安装
yum install -y docker-ce
启动查看版本

使用国内镜像加速
创建文件 /etc/docker/daemon.json
写入以下内容即可
{
"registry-mirrors": ["https://registry.docker-cn.com"]
}
docker拉镜像ok

创建容器:
docker run --name web01 -p 8080:80 -d nginx:latest
