docker 虚拟化,不是在在物理机上再去安装一个系统,而是直接启动应用级别的程序,例如启动三个tomcat,三个容器 ,对外访问后面讲解
镜像:docker的镜像其实就是模板,跟我们常见的iso镜像类似,上一个样板
容器:使用镜像常见的应用或者系统,我们称之为容器,应用的话就是tomcat nginx centos系统 都可以叫容器,容器就是一个应用,
仓库:仓库是存放镜像的地方,分为公开仓库和私有仓库两种形式
docker优点
跟传统vm比较具有如下优点
1、操作启动快
2、轻量级虚拟化

3、开源免费

centos6.5版本安装 ,centos7以上直接yum install docker


vim /etc/selinux/config  disabled

sestatus 

安装epel扩展

wget http://dl.Fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm

rpm -ivh epel-release-6-8.noarch.rpm



yum install lxc libcgroup



yum install docker-io

启动进程

/etc/init.d/docker start

查看进程

ps -ef|grep docker

安装镜像 

http://182.92.188.163/centos7.tar


netstat -anp 查看端口

docker常用命令

docker version

docker search centos 搜索镜像

docker pull centos  下载镜像

docker images 查看当前docker镜像

cat centos.tar|docker import - centos6 导入镜像

docker export id >centos6.tar 导出镜像  容器ip

docker run centos echo "hello world" 在docker 容器中运行hell world

docker run centos yum install ntpdate 在容器中安装ntpdate的程序

docker ps -l 命令获得最后一个容器的id,docker ps -a 查看所有的容器

进入一个新的容器 系统 -i表示可以交互输入   -t 表示打开一个终端的意思

dock run -i -t centos:latest /bin/bash

查看系统版本

cat /etc/centos-release