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

    1. [root@master cgroup]# cat /boot/config-3.10.0-1062.9.1.el7.x86_64 |grep CGROUPS
    2. CONFIG_CGROUPS=y

    Linux 子系统

    1. [root@instance-1 ~]# cd /sys/fs/cgroup/
    2. [root@instance-1 cgroup]# ll
    3. total 0
    4. drwxr-xr-x 4 root root 0 Apr 5 14:38 blkio
    5. lrwxrwxrwx 1 root root 11 Apr 5 14:38 cpu -> cpu,cpuacct
    6. lrwxrwxrwx 1 root root 11 Apr 5 14:38 cpuacct -> cpu,cpuacct
    7. drwxr-xr-x 4 root root 0 Apr 5 14:38 cpu,cpuacct
    8. drwxr-xr-x 3 root root 0 Apr 5 14:38 cpuset
    9. drwxr-xr-x 4 root root 0 Apr 5 14:42 devices
    10. drwxr-xr-x 3 root root 0 Apr 5 14:38 freezer
    11. drwxr-xr-x 3 root root 0 Apr 5 14:38 hugetlb
    12. drwxr-xr-x 4 root root 0 Apr 5 14:38 memory
    13. lrwxrwxrwx 1 root root 16 Apr 5 14:38 net_cls -> net_cls,net_prio
    14. drwxr-xr-x 3 root root 0 Apr 5 14:38 net_cls,net_prio
    15. lrwxrwxrwx 1 root root 16 Apr 5 14:38 net_prio -> net_cls,net_prio
    16. drwxr-xr-x 3 root root 0 Apr 5 14:38 perf_event
    17. drwxr-xr-x 4 root root 0 Apr 5 14:38 pids
    18. drwxr-xr-x 4 root root 0 Apr 5 14:38 systemd
    19. [root@instance-1 cgroup]# pwd
    20. /sys/fs/cgroup
    21. [root@instance-1 cgroup]#
    1. [root@instance-1 cpu]# pwd
    2. /sys/fs/cgroup/cpu
    3. [root@instance-1 cpu]# ls
    4. cgroup.clone_children cgroup.sane_behavior cpuacct.usage_percpu cpu.rt_period_us cpu.stat system.slice
    5. cgroup.event_control cpuacct.stat cpu.cfs_period_us cpu.rt_runtime_us notify_on_release tasks
    6. cgroup.procs cpuacct.usage cpu.cfs_quota_us cpu.shares release_agent user.slice
    7. [root@instance-1 cpu]# cat cpu.cfs_quota_us
    8. -1
    9. [root@instance-1 cpu]# cat cpu.cfs_period_us
    10. 100000
    11. [root@instance-1 cpu]#
    1. [root@instance-1 cgroup]# pwd
    2. /sys/fs/cgroup
    3. [root@instance-1 cgroup]# ll
    4. total 0
    5. drwxr-xr-x 4 root root 0 Apr 5 14:38 blkio
    6. lrwxrwxrwx 1 root root 11 Apr 5 14:38 cpu -> cpu,cpuacct
    7. lrwxrwxrwx 1 root root 11 Apr 5 14:38 cpuacct -> cpu,cpuacct
    8. drwxr-xr-x 4 root root 0 Apr 5 14:38 cpu,cpuacct
    9. drwxr-xr-x 3 root root 0 Apr 5 14:38 cpuset
    10. drwxr-xr-x 4 root root 0 Apr 5 14:42 devices
    11. drwxr-xr-x 3 root root 0 Apr 5 14:38 freezer
    12. drwxr-xr-x 3 root root 0 Apr 5 14:38 hugetlb
    13. drwxr-xr-x 4 root root 0 Apr 5 14:38 memory
    14. lrwxrwxrwx 1 root root 16 Apr 5 14:38 net_cls -> net_cls,net_prio
    15. drwxr-xr-x 3 root root 0 Apr 5 14:38 net_cls,net_prio
    16. lrwxrwxrwx 1 root root 16 Apr 5 14:38 net_prio -> net_cls,net_prio
    17. drwxr-xr-x 3 root root 0 Apr 5 14:38 perf_event
    18. drwxr-xr-x 4 root root 0 Apr 5 14:38 pids
    19. drwxr-xr-x 4 root root 0 Apr 5 14:38 systemd
    20. [root@instance-1 cgroup]#
    1. [root@instance-1 docker]# pwd
    2. /var/lib/docker
    3. [root@instance-1 docker]# ll
    4. total 4
    5. drwx------ 4 root root 150 Apr 5 14:43 containers
    6. drwx------ 3 root root 22 Apr 5 14:42 image
    7. drwxr-x--- 3 root root 19 Apr 5 14:42 network
    8. drwx------ 26 root root 4096 Apr 5 14:43 overlay2
    9. drwx------ 4 root root 32 Apr 5 14:42 plugins
    10. drwx------ 2 root root 6 Apr 5 14:42 swarm
    11. drwx------ 2 root root 6 Apr 5 14:43 tmp
    12. drwx------ 2 root root 6 Apr 5 14:42 trust
    13. drwx------ 2 root root 25 Apr 5 14:42 volumes
    14. [root@instance-1 docker]# cd containers/
    15. [root@instance-1 containers]# ls
    16. 63cc13311dee714977273a386e6b2d36b3945f4039d9c84f291d8c6b44de3f51 d7524487e169b07c217e569e3ae56c283229b0bac582a702e3864d5438d31110
    17. [root@instance-1 containers]# cd 63cc13311dee714977273a386e6b2d36b3945f4039d9c84f291d8c6b44de3f51/
    18. [root@instance-1 63cc13311dee714977273a386e6b2d36b3945f4039d9c84f291d8c6b44de3f51]# ls
    19. checkpoints config.v2.json hostconfig.json hostname hosts resolv.conf secrets shm
    20. [root@instance-1 63cc13311dee714977273a386e6b2d36b3945f4039d9c84f291d8c6b44de3f51]#

    查看容器内的进程号
    ps ax -O uid,uname,gid,group,ppid