centos7安装docker
2019-12-18 16:03:58来源:博客园 阅读 ()
centos7安装docker
1.官网中文安装参考手册
https://docs.docker-cn.com/engine/installation/linux/docker-ce/centos/#prerequisites
2、yum安装gcc相关
1)CentOS7能上外网
2)安装gcc
[root@localhost ~]# yum -y install gcc
3)安装gcc-c++
[root@localhost ~]# yum -y install gcc-c++
图像出现如下说明安装成功!!!
3、如果之前安装过docker,卸载旧版本
[root@localhost ~]# yum remove docker \
> docker-client \
> docker-client-latest \
> docker-common \
> docker-latest \
> docker-latest-logrotate \
> docker-logrotate \
> docker-engine
4、安装需要的软件包
[root@localhost ~]# yum install -y yum-utils device-mapper-persistent-data lvm2
5、设置stable镜像仓库
[root@localhost ~]# yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
6、更新yum软件包索引
[root@localhost ~]# yum makecache fast
7、安装DOCKER CE
[root@localhost ~]# yum -y install docker-ce
8、启动docker
[root@localhost ~]# systemctl start docker
9、测试
1)查看docker版本
[root@localhost ~]# docker version
Client:
Version: 18.09.6
API version: 1.39
Go version: go1.10.8
Git commit: 481bc77156
Built: Sat May 4 02:34:58 2019
OS/Arch: linux/amd64
Experimental: false
Server: Docker Engine - Community
Engine:
Version: 18.09.6
API version: 1.39 (minimum version 1.12)
Go version: go1.10.8
Git commit: 481bc77
Built: Sat May 4 02:02:43 2019
OS/Arch: linux/amd64
Experimental: false
[root@localhost ~]#
2)运行 hello-world
[root@localhost ~]# docker run hello-world
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/
[root@localhost ~]#
11、配置镜像加速
1)、获取阿里云镜像加速器参考:https://blog.csdn.net/li1325169021/article/details/90770119
[root@localhost ~]# mkdir -p /etc/docker
[root@localhost ~]# vim /etc/docker/daemon.json
在文件中添加如下配置
#阿里云镜像加速器
#网易云
{"registry-mirrors": ["http://hub-mirror.c.163.com"] }
#阿里云
{
"registry-mirrors": ["https://{自已的编码}.mirror.aliyuncs.com"]
}
[root@localhost ~]# systemctl daemon-reload
[root@localhost ~]# systemctl restart docker
2)、配置镜像加速后重启docker可能会报错,参考:https://blog.csdn.net/li1325169021/article/details/90782846
12、卸载
[root@localhost ~]# systemctl stop docker
[root@localhost ~]# yum -y remove docker-ce
[root@localhost ~]# rm -rf /var/lib/docker
原文链接:https://www.cnblogs.com/houston/p/12060849.html
如有疑问请与原作者联系
标签:
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com
特别注意:本站所有转载文章言论不代表本站观点,本站所提供的摄影照片,插画,设计作品,如需使用,请与原作者联系,版权归原作者所有
上一篇:inux 磁盘监控分析
- 安装Zabbix5.0 2020-06-10
- 运行 docker .... 命令报错 2020-06-10
- 容器技术之Docker私有镜像仓库harbor 2020-06-08
- windows10安装配置WSL(Ubuntu) 2020-06-07
- 容器技术之Docker私有镜像仓库docker-distribution 2020-06-07
IDC资讯: 主机资讯 注册资讯 托管资讯 vps资讯 网站建设
网站运营: 建站经验 策划盈利 搜索优化 网站推广 免费资源
网络编程: Asp.Net编程 Asp编程 Php编程 Xml编程 Access Mssql Mysql 其它
服务器技术: Web服务器 Ftp服务器 Mail服务器 Dns服务器 安全防护
软件技巧: 其它软件 Word Excel Powerpoint Ghost Vista QQ空间 QQ FlashGet 迅雷
网页制作: FrontPages Dreamweaver Javascript css photoshop fireworks Flash