Linux(centos7)下安装Docker

近期公司开始推Docker技术。这个系列的文章都是基于CentOS7系统下进行讲解的。

Docker简介

Docker 是一个开源的应用容器引擎,让开发者能够打包他们的应用以及依赖包到一个可移植的容器中,而后发布到任何流行的 Linux 机器上,也能够实现虚拟化。容器是彻底使用沙箱机制,相互之间不会有任何接口。Docker 使用客户端-服务器 (C/S) 架构模式,使用远程API来管理和建立Docker容器。Docker 容器经过 Docker 镜像来建立。容器与镜像的关系相似于面向对象编程中的对象与类。官网地址:http://www.docker.com/docker

 

Docker安装

系统要求CentOS 7.X 以上版本,内核至少3.10,64-bit编程

一、  uname –r 检查内核版本centos

二、  vi /etc/profile 修改代理设置(若是须要设置代理。内容以下,**为密码,密码要避免含有@符号)服务器

http_proxy=http://userName:password@10.16.236.108:3128/

ftp_proxy="http://userName:*****@10.16.236.108:3128/" 
https_proxy="https://userName:*****@10.16.236.108:3128/"
export https_proxy
export http_proxy
export ftp_proxy

三、yum update 升级本地yum包架构

四、tee /etc/yum.repos.d/docker.repo <<-'EOF'  添加yum 仓库配置(内容见下框)post

[dockerrepo]

name=Docker Repository

baseurl=https://yum.dockerproject.org/repo/main/centos/7/

enabled=1

gpgcheck=1

gpgkey=https://yum.dockerproject.org/gpg

EOF

 

五、yum install docker-engine 安装docker包url

六、service docker start 启动docker服务spa

七、mkdir /etc/systemd/system/docker.service.d代理

八、touch /etc/systemd/system/docker.service.d/http-proxy.conf  若是须要代理,添加docker程序代理(内容见下框)rest

[Service]                                                    例子   [Service]

Environment="HTTP_PROXY=http://proxy.ip.com:80"                     Enviroment=”HTTP_PROXY=http://用户名:密码@代理地址:端口号” 

 

十一、systemctl daemon-reload

十二、systemctl restart docker (第十一、12步。为重启docker操做)

1三、docker run hello-world  运行官方镜像hello world文件,检验是否安装成功。

相关文章
相关标签/搜索