Docker基本介绍

1、基本概念

虚拟机(virtual machine):在一个操作系统中模拟(模拟软、硬件)另外一个操作系统。

docker容器:将软件运行所需要的环境、代码、配置打包形成一个容器,系统变得轻量、高效。(容器没有内核、没有对硬件虚拟、浓缩版linux)

docker三要素:镜像、容器、仓库。
镜像:是模板(java的class)
容器:镜像的实例(java中类的实例、简易版的linux环境)
仓库:存放镜像的远程地址。

一、手把手教你在CentOS上安装Docker_docker学习

2、CentOS 6.8上安装Docker

2.1、安装运行环境

yum install -y epel-release

结果:

 From   : /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
运行 rpm_check_debug 
执行事务测试
事务测试成功
执行事务
  正在安装   : epel-release-6-8.noarch                                 1/1 
  Verifying  : epel-release-6-8.noarch                                 1/1 

已安装:
  epel-release.noarch 0:6-8                                                  

完毕!

2.2、安装docker

yum install -y docker-io

结果:

已安装:
  docker-io.x86_64 0:1.7.1-2.el6                                             

作为依赖被安装:
  libcgroup.x86_64 0:0.40.rc1-27.el6_10  lua-alt-getopt.noarch 0:0.7.0-1.el6 
  lua-filesystem.x86_64 0:1.4.2-1.el6    lua-lxc.x86_64 0:1.0.11-1.el6       
  lxc.x86_64 0:1.0.11-1.el6              lxc-libs.x86_64 0:1.0.11-1.el6      

完毕!

2.3、配置文件

[root@hadoop18 module]# cat /etc/sysconfig/docker
# /etc/sysconfig/docker
#
# Other arguments to pass to the docker daemon process
# These will be parsed by the sysv initscript and appended
# to the arguments list passed to docker -d

other_args=
DOCKER_CERT_PATH=/etc/docker

# Resolves: rhbz#1176302 (docker issue #407)
DOCKER_NOWARN_KERNEL_VERSION=1

# Location used for temporary files, such as those created by
# # docker load and build operations. Default is /var/lib/docker/tmp
# # Can be overriden by setting the following environment variable.
# # DOCKER_TMPDIR=/var/tmp

2.4、启动、停止docker

servcie docker start

service docker stop

2.5、验证docker完成安装

docker version
[root@hadoop18 module]# docker version
Client version: 1.7.1
Client API version: 1.19
Go version (client): go1.4.2
Git commit (client): 786b29d/1.7.1
OS/Arch (client): linux/amd64
Server version: 1.7.1
Server API version: 1.19
Go version (server): go1.4.2
Git commit (server): 786b29d/1.7.1
OS/Arch (server): linux/amd64