Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
liubin committed Aug 25, 2015
1 parent f15b3d5 commit db1482f
Show file tree
Hide file tree
Showing 19 changed files with 215 additions and 38 deletions.
23 changes: 13 additions & 10 deletions lesson-01/README.md
Expand Up @@ -8,28 +8,31 @@
[host]$ vagrant ssh
# 升级系统并重启
[docker101vm]$ sudo yum update
[docker101vm]$ sudo yum -y update
# 重启后重新编译 VirtualBox Guest Additions
[docker101vm]$ sudo yum install -y gcc kernel-devel-3.10.0-229.11.1.el7.x86_64
# 重启虚拟机
[docker101vm]$ exit
[host]$ vagrant reload
[host]$ vagrant ssh
# 重启后重新编译 VirtualBox Guest Additions
[docker101vm]$ sudo yum -y install kernel-devel-3.10.0-229.7.2.el7.x86_64
[docker101vm]$ sudo yum install -y gcc
# 重新编译 VirtualBox Guest Additions
[docker101vm]$ sudo /etc/init.d/vboxadd setup
# 之后再向上面那样重启即可。
# 再次重启即可
```

安装Docker(docker-engine)

```
$ sudo curl -sSL https://get.docker.com/ | sh
+ sudo -E sh -c 'sleep 3; yum -y -q install docker-engine'
warning: /var/cache/yum/x86_64/7/docker-main-repo/packages/docker-engine-1.7.1-1.el7.centos.x86_64.rpm: Header V4 RSA/SHA1 Signature, key ID 2c52609d: NOKEY
Public key for docker-engine-1.7.1-1.el7.centos.x86_64.rpm is not installed
Failed to set locale, defaulting to C
warning: /var/cache/yum/x86_64/7/docker-main-repo/packages/docker-engine-1.8.1-1.el7.centos.x86_64.rpm: Header V4 RSA/SHA1 Signature, key ID 2c52609d: NOKEY
Public key for docker-engine-1.8.1-1.el7.centos.x86_64.rpm is not installed
Importing GPG key 0x2C52609D:
Userid : "Docker Release Tool (releasedocker) <docker@docker.com>"
Fingerprint: 5811 8e89 f3a9 1289 7c07 0adb f762 2157 2c52 609d
Expand Down Expand Up @@ -57,7 +60,7 @@ sudo systemctl enable docker

```
sudo vi /lib/systemd/system/docker.service
/usr/bin/docker --registry-mirror=http://liubin.m.alauda.cn -d -H fd://
/usr/bin/docker daemon --registry-mirror=http://liubin.m.alauda.cn -H fd://
sudo systemctl daemon-reload
```
Expand Down
30 changes: 20 additions & 10 deletions lesson-01/keynote.md
@@ -1,6 +1,8 @@
# Docker入门与实践

刘斌,软件工程师@OneAPM
2015年8月


# 课程简介

Expand All @@ -18,6 +20,11 @@
- 官方文档(https://docs.docker.com/)
- 《第一本Docker书》

# 致谢

- 开课吧
- 灵雀云(http://www.alauda.cn/)

# 什么是Docker

- Build, Ship, Run
Expand Down Expand Up @@ -146,6 +153,14 @@
- user: 用户隔离(3.8)



# Docker将会给这些领域带来影响

- Software development
- Deploy & Delivery
- DevOps


# 12-Factor App

- Codebase
Expand All @@ -159,12 +174,6 @@
- Dev/prod parity
- Logs

# Lesson-01 Docker将会给这些领域带来影响

- Software development
- Deploy & Delivery
- DevOps

# Docker适用场景

- 开发
Expand Down Expand Up @@ -317,7 +326,7 @@
- $ sudo systemctl enable docker
- $ sudo systemctl start docker
- $ sudo docker -v
- Docker version 1.7.1, build 786b29d
- Docker version 1.8.1, build d12ea79

# 设置镜像加速

Expand All @@ -329,8 +338,9 @@
- https://github.com/liubin/docker101
- Alauda社区

# 致谢
# 课后作业

- 开课吧
- 灵雀云(http://www.alauda.cn/)
- 浏览官方文档
- 安装Docker
- 注册alauda.cn账户

13 changes: 10 additions & 3 deletions lesson-02/keynote.md
@@ -1,7 +1,8 @@
# Docker入门与实践

Lesson-02 运行Docker容器
刘斌
刘斌@OneAPM
2015年8月

# 本节概要

Expand Down Expand Up @@ -187,8 +188,6 @@ docker run -it --add-host db-server:10.10.0.100
- always
- 每次重试间隔时间都翻倍,直到stop或rm -f



# docker rename

- docker rename OLD_NAME NEW_NAME
Expand Down Expand Up @@ -434,6 +433,14 @@ docker run -t -i --rm --cap-add=NET_ADMIN ubuntu:14.04 ip link add dummy0 type d
- -w=""


# 课后作业

- 下载centos:7仓库
- docker run -it centos:7 bash
- docker ps -a
- docker rm





35 changes: 34 additions & 1 deletion lesson-03/keynote.md
@@ -1,7 +1,8 @@
# Docker入门与实践

Lesson-03 理解Docker镜像
刘斌
刘斌@OneAPM
2015年8月

# 本节概要

Expand Down Expand Up @@ -64,6 +65,12 @@ Lesson-03 理解Docker镜像
- push
- tag

# push到灵雀云

- 创建镜像仓库
- docker login
- docker push

# 共享镜像

- 镜像存储
Expand All @@ -77,6 +84,23 @@ Lesson-03 理解Docker镜像
- export/import
- save/load

# export/import

- export:整个mount,将rootfs打成一个tar包
- import:tar包解包而已
- 镜像层级关系和metadata丢失
- 不能共享层文件,占用大量磁盘空间
- 能导入物理机或者虚拟机的rootfs

# save/load

- 按镜像层分别打tar包
- 一层层mount,打包
- 先打base
- mount下一层,打包差分
- 记录metadata
- 将结果再打成一个tar包

# 通过docker commit命令构建镜像

- docker run -it base bash
Expand All @@ -99,3 +123,12 @@ Lesson-03 理解Docker镜像
- VOLUME
- WORKDIR


# 课后作业

- docker pull
- docker history|inspect
- docker images/rmi
- docker commit


21 changes: 20 additions & 1 deletion lesson-04/keynote.md
@@ -1,7 +1,8 @@
# Docker入门与实践

Lesson-04 使用Dockerfile构建镜像
刘斌
刘斌@OneAPM
2015年8月

# 本节概要

Expand Down Expand Up @@ -331,6 +332,18 @@ VOLUME /myvol
- 影响RUN/CMD/ENTRYPOINT
- RUN groupadd -r postgres && useradd -r -g postgres postgres
- UID/GID不能保证可重现性,可显示指定
- 默认为root

# USER

```bash
USER user
USER user:group
USER uid
USER uid:gid
USER user:gid
USER uid:group
```

# WORKDIR

Expand Down Expand Up @@ -391,3 +404,9 @@ RUN pwd
- 最小安装
- 注意build cache(apt-get -y update问题)

# 课后作业

- 基于centos:7构建自己的语言栈
- COPY
- WORKDIR/ENV
- EXEC/CMD
9 changes: 8 additions & 1 deletion lesson-05/keynote.md
@@ -1,7 +1,8 @@
# Docker入门与实践

Lesson-05 构建私有镜像服务器
刘斌
刘斌@OneAPM
2015年8月

# 本节概要

Expand Down Expand Up @@ -122,3 +123,9 @@ $ docker run -d -p 5000:5000 \
- 开源:MariaDB + Rails + Registry
- 演示

# 课后作业

- 运行自己的私有Registry
- 构建一个镜像并push到该Registry
- 在本地删除该镜像
- 从私有镜像pull出来
10 changes: 9 additions & 1 deletion lesson-06/keynote.md
@@ -1,7 +1,8 @@
# Docker入门与实践

Lesson-06 Docker Hub和自动构建
刘斌
刘斌@OneAPM
2015年8月

# 本节概要

Expand Down Expand Up @@ -112,3 +113,10 @@ Lesson-06 Docker Hub和自动构建
- 读取私有仓库
- 向非自动构建仓库push
- Admin权限,修改仓库的描述,写作者;公开、私有以及删除仓库

# 课后作业

- 注册GitHub/Bitbucket和Docker Hub
- 创建自动构建
- 提交Dockerfile进行自动构建
- 本地docker pull下载该自动构建镜像
11 changes: 10 additions & 1 deletion lesson-07/keynote.md
@@ -1,7 +1,8 @@
# Docker入门与实践

Lesson-07 Docker Link
刘斌
刘斌@OneAPM
2015年8月

# 本节概要

Expand Down Expand Up @@ -111,3 +112,11 @@ root@aed84ee21bde:/opt/webapp# cat /etc/hosts
![](images/etcd-ambassador-flow.png)

图片来源:https://coreos.com/assets/images/media/etcd-ambassador-flow.png


# 课后作业

- 在两个容器中使用link
- 在目的容器中检查ENV,/etc/hosts等
- 确认网络连通性

10 changes: 9 additions & 1 deletion lesson-08/keynote.md
@@ -1,7 +1,8 @@
# Docker入门与实践

Lesson-08 Docker Volume
刘斌
刘斌@OneAPM
2015年8月

# 本节概要

Expand Down Expand Up @@ -93,3 +94,10 @@ $ docker run -d --name db3 --volumes-from db1 training/postgres
$ docker run --volumes-from dbdata -v $(pwd):/backup ubuntu tar cvf /backup/backup.tar /dbdata
```

# 课后作业

- 通过-v启动第一个容器
- 在该容器中对volume中的数据进行修改
- 启动第二个容器,使用--volumes-from
- 在第二个容器中查看volume中的数据

7 changes: 6 additions & 1 deletion lesson-09/keynote.md
@@ -1,7 +1,8 @@
# Docker入门与实践

Lesson-09 Docker Compose
刘斌
刘斌@OneAPM
2015年8月

# 本节概要

Expand Down Expand Up @@ -244,3 +245,7 @@ security_opt:
- 面向单主机
- 不能解决网络和存储问题

# 课后作业

- 运行同目录下的例子
- 构建自己的应用栈:App + DB
8 changes: 7 additions & 1 deletion lesson-10/keynote.md
@@ -1,7 +1,8 @@
# Docker入门与实践

Lesson-10 Docker Machine
刘斌
刘斌@OneAPM
2015年8月

# 本节概要

Expand Down Expand Up @@ -135,3 +136,8 @@ docker-machine create \



# 课后作业

- 使用VirtualBox创建Docker主机
- 有条件的话可以在云服务器上创建Docker主机

7 changes: 6 additions & 1 deletion lesson-11/keynote.md
@@ -1,7 +1,8 @@
# Docker入门与实践

Lesson-11 Docker Swarm
刘斌
刘斌@OneAPM
2015年8月

# 本节概要

Expand Down Expand Up @@ -196,5 +197,9 @@ docker run -e affinity:com.example.type==frontend

- 避免容器被分配到不健康的节点

# 课后作业

- 使用Docker Machine创建Swarm集群
- 1个master,2个node


Binary file added lesson-12/images/flannel-packet.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added lesson-12/images/flannel.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added lesson-12/images/weave-arch.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit db1482f

Please sign in to comment.