4月7日
20:30-22:30
课时 2
课外基础
0.课前准备 ,必要的环境
1.学习Docker前需要有 Linux命令操作基础
2.学习虚拟化的几种常见方式
3.预备课程所需要的环境 ,虚拟机Terminal工具和必须的记录工具
4.工具准备 :VirtualBox ,Ntepad+ , Wireshak ,Xeltc
5.做好和课程同步的时间安排计划 ,对应相的课节记录
课程重点:
了解什么是 Docker,以及为什么企业要从传统方式向、Docker容器化转变掌握Docker 架构设计原理
了解Docker主要组件 ,为后续课程学习做准备、理解虚拟化的本质,为后期的Kubernts 做好基础
Docker基础
Docker是什么?
Docker有什么用?
案例了解Docker
Docker架构说明
Docker主要组件与概念介绍
容器技术
容器技术发展
为什么要选择Docker
Cgroup介绍
Namespace介绍
Namespace是Linux内核在task_struct中对进程组管理的基础机制
Linux内核中提供了6种Namespace隔离
Namespace | 隔离内容 |
---|---|
IPC | |
Network | |
Mount | |
PID | |
UTS | |
User |
cgroup:实现资源限制
namespace:实现资源隔离
Docker容器
Docker Containres介绍
Docker Containers的启动和停止
Docker Containers 修改和备份
课后作业
1:图解Docker及模块理解
2:虚拟化有几种方式
3:Docker command应用 docker —help的应用
查看Linux系统是否启动了 Cgroup
[root@master cgroup]# cat /boot/config-3.10.0-1062.9.1.el7.x86_64 |grep CGROUPS
CONFIG_CGROUPS=y
Linux 子系统
[root@instance-1 ~]# cd /sys/fs/cgroup/
[root@instance-1 cgroup]# ll
total 0
drwxr-xr-x 4 root root 0 Apr 5 14:38 blkio
lrwxrwxrwx 1 root root 11 Apr 5 14:38 cpu -> cpu,cpuacct
lrwxrwxrwx 1 root root 11 Apr 5 14:38 cpuacct -> cpu,cpuacct
drwxr-xr-x 4 root root 0 Apr 5 14:38 cpu,cpuacct
drwxr-xr-x 3 root root 0 Apr 5 14:38 cpuset
drwxr-xr-x 4 root root 0 Apr 5 14:42 devices
drwxr-xr-x 3 root root 0 Apr 5 14:38 freezer
drwxr-xr-x 3 root root 0 Apr 5 14:38 hugetlb
drwxr-xr-x 4 root root 0 Apr 5 14:38 memory
lrwxrwxrwx 1 root root 16 Apr 5 14:38 net_cls -> net_cls,net_prio
drwxr-xr-x 3 root root 0 Apr 5 14:38 net_cls,net_prio
lrwxrwxrwx 1 root root 16 Apr 5 14:38 net_prio -> net_cls,net_prio
drwxr-xr-x 3 root root 0 Apr 5 14:38 perf_event
drwxr-xr-x 4 root root 0 Apr 5 14:38 pids
drwxr-xr-x 4 root root 0 Apr 5 14:38 systemd
[root@instance-1 cgroup]# pwd
/sys/fs/cgroup
[root@instance-1 cgroup]#
[root@instance-1 cpu]# pwd
/sys/fs/cgroup/cpu
[root@instance-1 cpu]# ls
cgroup.clone_children cgroup.sane_behavior cpuacct.usage_percpu cpu.rt_period_us cpu.stat system.slice
cgroup.event_control cpuacct.stat cpu.cfs_period_us cpu.rt_runtime_us notify_on_release tasks
cgroup.procs cpuacct.usage cpu.cfs_quota_us cpu.shares release_agent user.slice
[root@instance-1 cpu]# cat cpu.cfs_quota_us
-1
[root@instance-1 cpu]# cat cpu.cfs_period_us
100000
[root@instance-1 cpu]#
[root@instance-1 cgroup]# pwd
/sys/fs/cgroup
[root@instance-1 cgroup]# ll
total 0
drwxr-xr-x 4 root root 0 Apr 5 14:38 blkio
lrwxrwxrwx 1 root root 11 Apr 5 14:38 cpu -> cpu,cpuacct
lrwxrwxrwx 1 root root 11 Apr 5 14:38 cpuacct -> cpu,cpuacct
drwxr-xr-x 4 root root 0 Apr 5 14:38 cpu,cpuacct
drwxr-xr-x 3 root root 0 Apr 5 14:38 cpuset
drwxr-xr-x 4 root root 0 Apr 5 14:42 devices
drwxr-xr-x 3 root root 0 Apr 5 14:38 freezer
drwxr-xr-x 3 root root 0 Apr 5 14:38 hugetlb
drwxr-xr-x 4 root root 0 Apr 5 14:38 memory
lrwxrwxrwx 1 root root 16 Apr 5 14:38 net_cls -> net_cls,net_prio
drwxr-xr-x 3 root root 0 Apr 5 14:38 net_cls,net_prio
lrwxrwxrwx 1 root root 16 Apr 5 14:38 net_prio -> net_cls,net_prio
drwxr-xr-x 3 root root 0 Apr 5 14:38 perf_event
drwxr-xr-x 4 root root 0 Apr 5 14:38 pids
drwxr-xr-x 4 root root 0 Apr 5 14:38 systemd
[root@instance-1 cgroup]#
[root@instance-1 docker]# pwd
/var/lib/docker
[root@instance-1 docker]# ll
total 4
drwx------ 4 root root 150 Apr 5 14:43 containers
drwx------ 3 root root 22 Apr 5 14:42 image
drwxr-x--- 3 root root 19 Apr 5 14:42 network
drwx------ 26 root root 4096 Apr 5 14:43 overlay2
drwx------ 4 root root 32 Apr 5 14:42 plugins
drwx------ 2 root root 6 Apr 5 14:42 swarm
drwx------ 2 root root 6 Apr 5 14:43 tmp
drwx------ 2 root root 6 Apr 5 14:42 trust
drwx------ 2 root root 25 Apr 5 14:42 volumes
[root@instance-1 docker]# cd containers/
[root@instance-1 containers]# ls
63cc13311dee714977273a386e6b2d36b3945f4039d9c84f291d8c6b44de3f51 d7524487e169b07c217e569e3ae56c283229b0bac582a702e3864d5438d31110
[root@instance-1 containers]# cd 63cc13311dee714977273a386e6b2d36b3945f4039d9c84f291d8c6b44de3f51/
[root@instance-1 63cc13311dee714977273a386e6b2d36b3945f4039d9c84f291d8c6b44de3f51]# ls
checkpoints config.v2.json hostconfig.json hostname hosts resolv.conf secrets shm
[root@instance-1 63cc13311dee714977273a386e6b2d36b3945f4039d9c84f291d8c6b44de3f51]#
查看容器内的进程号
ps ax -O uid,uname,gid,group,ppid