Centos7上安装和使用Docker

Kai Docker, 工作 3,419 次浏览 没有评论

环境:CentOS 7

Docker支持CentOS 6及以后的版本。

对于CentOS 6系统可使用EPEL库安装Docker, 命令如下:

yum install -yhttp://mirrors.yun-idc.com/epel/6/i386/epel-release-6-8.noarch.rpm

yum install -y docker-io

 
 

首先关闭selinux

[root@localhost ~]# yum install -y docker

也可以换成国内源,速度比较快.我换成阿里的.

先备份自带源,万一出错改回来

[root@localhost ~]# mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup

[root@localhost ~]# wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

 
 

安装完毕手动启动下

[root@localhost ~]# systemctl start docker

[root@localhost ~]# systemctl enable docker

[root@zabbix-server ~]# docker pull ubuntu ##可以在后面指定Ubuntu版本,比如docker pull ubuntu14.04

如果不指定版本号,默认下载最新的

 
 

下载完成就是运行

[root@localhost ~]# docker run -t -i ubuntu /bin/bash

查看

[root@localhost ~]# docker images

 
 

#TAG 用来标记来自同一个仓库的不同镜像,例如Ubuntu仓库有多个镜像,10.04 , 12.04,12.10

 
 

 
 

发表回复

Go