赞
踩
centOS 7
环境查看
查看系统内核:系统内核需要 3.10 以上的(必须)
uname -r
查看系统版本
cat /etc/os-release
官方帮助文档:Install Docker Engine on CentOS | Docker Documentation
1、卸载旧的版本(如果安装过)
- yum remove docker \
- docker-client \
- docker-client-latest \
- docker-common \
- docker-latest \
- docker-latest-logrotate \
- docker-logrotate \
- docker-engine
2、安装需要的安装包
yum install -y yum-utils
3、设置镜像的仓库(官方默认是国外的,推荐使用国内阿里云镜像)
yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
4、安装docker相关的内容
#更新软件包索引
yum makecache fast
#安装docker软件包 docker-ce社区版 ee 企业版
yum install docker-ce docker-ce-cli containred.io
5、启动docker
#启动
systemctl start docker
#查看docker是否安装成功和版本
docker version
6、测试hello world
docker run hello-world
#####
Unable to find image 'hello-world:latest' locally #没有找到hello-world镜像
latest: Pulling from library/hello-world #远程拉取官方镜像
2db29710123e: Pull complete #获取签名信息拉取成功
Digest: sha256:cc15c5b292d8525effc0f89cb299f1804f3a725c8d05e158653a563f15e4f685
Status: Downloaded newer image for hello-world:latest
Hello from Docker! #运行容器
This message shows that your installation appears to be working correctly.
To generate this message, Docker took the following steps:
1. The Docker client contacted the Docker daemon.
2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
(amd64)
3. The Docker daemon created a new container from that image which runs the
executable that produces the output you are currently reading.
4. The Docker daemon streamed that output to the Docker client, which sent it
to your terminal.
To try something more ambitious, you can run an Ubuntu container with:
$ docker run -it ubuntu bash
Share images, automate workflows, and more with a free Docker ID:
https://hub.docker.com/
For more examples and ideas, visit:
https://docs.docker.com/get-started/
#####
安装成功正常运行
7、查看下载的这个hello-world镜像
#查看镜像
docker images
- yum remove docker \
- docker-client \
- docker-client-latest \
- docker-common \
- docker-latest \
- docker-latest-logrotate \
- docker-logrotate \
- docker-engine
1.卸载依赖
yum remove docker-ce docker-ce-cli containerd.io
2.删除资源
# /var/lib/docker 默认工作路径(资源路径)
rm -rf /var/lib/docker
阿里云镜像加速
sudo mkdir -p /etc/docker #编写配置文件
sudo tee /etc/docker/daemon.json <<-'EOF'
{
"registry-mirrors": ["https://263xr7xg.mirror.aliyuncs.com"]
}
EOF
sudo systemctl daemon-reload #从启docker
sudo systemctl restart docker #启动docker
1、protainer(临时使用,不推荐)
Docker图形化界面管理工具!提供一个后台米娜本供我们操作
docker run -d --name portainer -p 8088:9000 --restart=always -v /var/run/docker.sock:/var/run/docker.sock --privileged=true portainer/portainer
访问测试:http://{ip}:8088/
首次登录需要创建用户密码
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。