[Docker] basis (a)

Super lightweight virtualization

What is a container
two what is docker
three docker advantage of
four docker disadvantages of
five deployed docker
###############################

What is a container

• 容器技术已经成为应用程序封装和交付的核心技术
• 容器技术的核心有以下几个内核技术组成:
	– Cgroups(Control Groups)-资源管理
	– NameSpace-进程隔离
	– SELinux安全
• 由于是在物理机上实施隔离,启动一个容器,可以像启动一个进程一样快速

What are the two docker

 • Docker是完整的一套容器管理系统
 • Docker提供了一组命令,让用户更加方便直接地使
   用容器技术,而不需要过多关心底层内核技术

Three docker advantage

• 相比于传统的虚拟化技术,容器更加简洁高效
• 传统虚拟机需要给每个VM安装操作系统
• 容器使用的共享公共库和程序

Four docker shortcomings

• 容器的隔离性没有虚拟化强
• 共用Linux内核,安全性有先天缺陷
• SELinux难以驾驭
• 监控容器和容器排错是挑战

Five deployment docker

(1)安装前准备
	• 需要64位操作系统
	• 至少RHEL6.5以上的版本,强烈推荐RHEL7
	• 关闭防火墙(不是必须)
(2)安装docker
	# yum -y install docker
	# systemctl restart docker
	# systemctl enable docker

#######################
Composition: Mirror / container
Mirror: template
################### ####
# mirror and container management command

1. What is a mirror (to start the virtual machine template)

• 在Docker中容器是基于镜像启动的
• 镜像是启动容器的核心
• 镜像采用分层设计
• 使用快照的COW技术,确保底层数据不丢失

2. Mirror commonly used commands

(1)#docker images  //查看镜像列表
	镜像仓库名称  标签  ID  创建时间  大小
(2)#docker search centos/mysql  //查找镜像(name镜像名字/official是否官方)		
(3)#docker pull 镜像名称  //下载镜像
	docker pull docker.io/busybox 
(4)#docker push 镜像名称  //上传镜像
	docker push docker.io/busybox
(5)#docker history   //查看镜像制作历史
	看你摞了几层楼了
	docker history docker.io/centos:latest
(6)#docker inspect  //查看镜像底层信息(后边可以跟镜像/容器/网络)
	docker inspect docker.io/nginx:latest
(7)#docker rmi  //删除本地镜像
(8)#docker save //镜像保存为tar包
(9)#docker load //使用tar包导入镜像
	#docker load -i xx.tar
(10)#docker tag //修改镜像名称和标签

3. The container commonly used commands

(1)#docker 子命令  参数  镜像名称:标签  启动命令
	docker  run  -it   docker.io/centos:latest  /bin/bash(特指容器里的命令)
	-i(交互式)
	-t(tty终端)
	-d(daemon后台进程)
	
(2)#docker ps //查看容器列表
	docker ps //显示正在运行的容器
	docker ps -a(显示所有容器)q(只显示容器ID)
	
(3)#docker stop //关闭容器
(4)#docker start //启动容器
(5)#docker restart //重启容器
	
(6)#docker attach|exec //进入容器
	
(7)#docker inspect //查看容器底层信息
	
(8)#docker top //查看容器进程列表
	docker top 容器ID
(9)#docker rm  //删除容器

4. The backup and restore mirroring

(备份)#docker save -o(output) busybox 名称:标签
     #docker save -o busybox.tar docker.io/busybox:latest
	 名称(可以重复)  标签(可重复)  id(必须是唯一)  时间  大小
	 但是名称+标签不可以重复=(路径+文件名不可以重复)
	 (标签不写就是latest)
	 备份的时候要写唯一
(恢复)#docker load -i(input) busybox.tar

Guess you like

Origin blog.csdn.net/qq_44839276/article/details/91426025