[Docker] 安装Docker环境


1. 关闭SELINUX服务

SELINUX是CentOS自带的安全服务,因为晦涩难用,并且跟很多程序冲突,所以强烈建议大家关闭这个服务。 找到 /etc/sysconfig/selinux 文件,把其中的SELINUX 设置为 disabled,保存文件之后重启CentOS系 统。

vi /etc/sysconfig/selinux

使用vi编辑器打开之后可以看见如下:

# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#     enforcing - SELinux security policy is enforced.
#     permissive - SELinux prints warnings instead of enforcing.
#     disabled - No SELinux policy is loaded.
SELINUX=enforcing
# SELINUXTYPE= can take one of three values:
#     targeted - Targeted processes are protected,
#     minimum - Modification of targeted policy. Only selected processes are protected.
#     mls - Multi Level Security protection.
SELINUXTYPE=targeted

我们只需要将SELINUX=enforcing修改为SELINUX=disabled,如下所示:

# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#     enforcing - SELinux security policy is enforced.
#     permissive - SELinux prints warnings instead of enforcing.
#     disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of three values:
#     targeted - Targeted processes are protected,
#     minimum - Modification of targeted policy. Only selected processes are protected.
#     mls - Multi Level Security protection.
SELINUXTYPE=targeted

在vi编辑器中修改之后通过wq命令保存并退出,然后重启(命令:reboot)Linux宿主机即可

2.更新yum程序

yum命令是CentOS自带的软件包管理器,我们安装Docker之前,最好能先更新—下yum命令,然后等上十分钟左右,yum就更新好了。

yum update -y

安装Docker

执行安装命令,Docker就自动安装就好。

yum install docker -y

3. 安装Docker

执行安装命令,Docker就自动安装好了。

yum install docker -y

4. 管理Docker

启动和关闭Docker服务,可以通过下面的命令完成。每次启动Linux系统,别忘了要运行Docker服务,切记!

service docker start
service docker stop

查看Docker中的镜像列表,可以执行下面的命令。

docker images

想要删除某个镜像可以用下面的命令。

docker rmi 镜像名字

分类:DevOps
标签: Docker
文章目录