Docker-02 无人值守安装 docker

 1 #!/bin/bash
 2 
 3 #
 4 #    无人值守安装 docker
 5 #
 6 
 7 #
 8 #    1、关闭SELinux
 9 #
10 
11 setenforce 0
12 sed -i 's/SELINUX=enforcinf/SELINUX=disabled/' /etc/sysconfig/selinux
13 
14 #
15 #    2、配置阿里云的 docker-engine YUM 源
16 #
17 
18 tee /etc/yum.repos.d/docker.repo <<-'EOF'
19 [dockerrepo]
20 name=Docker Repository
21 baseurl=http://mirrors.aliyun.com/docker-engine/yum/main/centos/$releasever/
22 enabled=1
23 gpgcheck=1
24 gpgkey=http://mirrors.aliyun.com/docker-engine/yum/gpg
25 EOF
26 
27 #
28 #    3、安装 docker-engine
29 #
30 
31 yum install -y docker-engine
32 
33 #
34 #    4、启动 docker 并设置 docker 开机自动运行
35 #
36 
37 service docker start
38 chkconfig docker on
39 
40 #
41 #    5、验证 docker 安装成功
42 #
43 
44 docker version

 

posted @ 2016-05-27 00:36  三角形  阅读(322)  评论(0编辑  收藏  举报