admin 修订了这个 Gist . 跳至此修订
1 file changed, 1 insertion, 1 deletion
h1.md
@@ -1,4 +1,4 @@ | |||
1 | - | ### 云原生基础设施之容器入门 | |
1 | + | ## 云原生基础设施之容器入门 | |
2 | 2 | 打开终端ssh链接后,首先修改镜像源 | |
3 | 3 | ``` | |
4 | 4 | vim /etc/docker/daemon.json |
admin 修订了这个 Gist . 跳至此修订
1 file changed, 1 insertion
h1.md
@@ -1,3 +1,4 @@ | |||
1 | + | ### 云原生基础设施之容器入门 | |
1 | 2 | 打开终端ssh链接后,首先修改镜像源 | |
2 | 3 | ``` | |
3 | 4 | vim /etc/docker/daemon.json |
admin 修订了这个 Gist . 跳至此修订
1 file changed, 26 insertions
h1.md
@@ -65,4 +65,30 @@ curl -X GET http://localhost:5000/v2/httpd/tags/list | |||
65 | 65 | ||
66 | 66 | # 3. 返回结果(考点) | |
67 | 67 | {"name":"httpd","tags":["v1"]} | |
68 | + | ``` | |
69 | + | ||
70 | + | ||
71 | + | 实验三 | |
72 | + | ``` | |
73 | + | # 1. 暂停容器 | |
74 | + | docker pause httpd-test | |
75 | + | ||
76 | + | # 2. 恢复容器 | |
77 | + | docker unpause httpd-test | |
78 | + | ||
79 | + | # 3. 停止容器 | |
80 | + | docker stop httpd-test | |
81 | + | ||
82 | + | # 4. 重启容器 | |
83 | + | docker restart httpd-test | |
84 | + | ||
85 | + | # 5. 删除容器 | |
86 | + | docker stop httpd-test | |
87 | + | docker rm httpd-test | |
88 | + | ||
89 | + | # 6. 删除镜像 | |
90 | + | docker rmi httpd:v1 | |
91 | + | ||
92 | + | # 7. 验证返回内容(考点) | |
93 | + | Untagged: httpd:v1 | |
68 | 94 | ``` |
admin 修订了这个 Gist . 跳至此修订
1 file changed, 16 insertions
h1.md
@@ -49,4 +49,20 @@ docker run -d -p 80:80 --name httpd-test httpd:v1 | |||
49 | 49 | 5. 浏览器访问http://EIP:80并多刷新几次,返回以下即可(考点) | |
50 | 50 | ``` | |
51 | 51 | dockerfile test | |
52 | + | ``` | |
53 | + | ||
54 | + | 实验二 | |
55 | + | ``` | |
56 | + | # 0. 启用私有镜像仓库容器(监听5000端口)(考点) | |
57 | + | docker run -d -p 5000:5000 --name registry registry | |
58 | + | ||
59 | + | # 1. 给本地镜像打标签并推送至私有仓库 | |
60 | + | docker tag httpd:v1 localhost:5000/httpd:v1 | |
61 | + | docker push localhost:5000/httpd:v1 | |
62 | + | ||
63 | + | # 2. 验证是否上传成功 | |
64 | + | curl -X GET http://localhost:5000/v2/httpd/tags/list | |
65 | + | ||
66 | + | # 3. 返回结果(考点) | |
67 | + | {"name":"httpd","tags":["v1"]} | |
52 | 68 | ``` |
admin 修订了这个 Gist . 跳至此修订
1 file changed, 6 insertions, 6 deletions
h1 重命名为 h1.md
@@ -18,17 +18,17 @@ systemctl restart docker | |||
18 | 18 | ||
19 | 19 | 实验一 | |
20 | 20 | ||
21 | - | # 0. 拉取httpd镜像 | |
21 | + | 0. 拉取httpd镜像 | |
22 | 22 | ``` | |
23 | 23 | docker pull httpd | |
24 | 24 | ``` | |
25 | 25 | ||
26 | - | # 1. 创建dockerfile文件 | |
26 | + | 1. 创建dockerfile文件 | |
27 | 27 | ``` | |
28 | 28 | vim dockerfile | |
29 | 29 | ``` | |
30 | 30 | ||
31 | - | # 2. 输入以下内容 | |
31 | + | 2. 输入以下内容 | |
32 | 32 | ``` | |
33 | 33 | FROM httpd | |
34 | 34 | MAINTAINER [email protected] | |
@@ -36,17 +36,17 @@ EXPOSE 80 | |||
36 | 36 | RUN echo "dockerfile test" > /usr/local/apache2/htdocs/index.html | |
37 | 37 | ``` | |
38 | 38 | ||
39 | - | # 3. 构建镜像 | |
39 | + | 3. 构建镜像 | |
40 | 40 | ``` | |
41 | 41 | docker build -t httpd:v1 . | |
42 | 42 | ``` | |
43 | 43 | ||
44 | - | # 4. 运行容器并映射端口 | |
44 | + | 4. 运行容器并映射端口 | |
45 | 45 | ``` | |
46 | 46 | docker run -d -p 80:80 --name httpd-test httpd:v1 | |
47 | 47 | ``` | |
48 | 48 | ||
49 | - | # 5. 浏览器访问http://EIP:80并多刷新几次,返回以下即可(考点) | |
49 | + | 5. 浏览器访问http://EIP:80并多刷新几次,返回以下即可(考点) | |
50 | 50 | ``` | |
51 | 51 | dockerfile test | |
52 | 52 | ``` |
admin 修订了这个 Gist . 跳至此修订
1 file changed, 41 insertions
h1
@@ -9,3 +9,44 @@ vim /etc/docker/daemon.json | |||
9 | 9 | } | |
10 | 10 | ``` | |
11 | 11 | ||
12 | + | wq保存退出,重启docker | |
13 | + | ||
14 | + | ``` | |
15 | + | systemctl daemon-reload | |
16 | + | systemctl restart docker | |
17 | + | ``` | |
18 | + | ||
19 | + | 实验一 | |
20 | + | ||
21 | + | # 0. 拉取httpd镜像 | |
22 | + | ``` | |
23 | + | docker pull httpd | |
24 | + | ``` | |
25 | + | ||
26 | + | # 1. 创建dockerfile文件 | |
27 | + | ``` | |
28 | + | vim dockerfile | |
29 | + | ``` | |
30 | + | ||
31 | + | # 2. 输入以下内容 | |
32 | + | ``` | |
33 | + | FROM httpd | |
34 | + | MAINTAINER [email protected] | |
35 | + | EXPOSE 80 | |
36 | + | RUN echo "dockerfile test" > /usr/local/apache2/htdocs/index.html | |
37 | + | ``` | |
38 | + | ||
39 | + | # 3. 构建镜像 | |
40 | + | ``` | |
41 | + | docker build -t httpd:v1 . | |
42 | + | ``` | |
43 | + | ||
44 | + | # 4. 运行容器并映射端口 | |
45 | + | ``` | |
46 | + | docker run -d -p 80:80 --name httpd-test httpd:v1 | |
47 | + | ``` | |
48 | + | ||
49 | + | # 5. 浏览器访问http://EIP:80并多刷新几次,返回以下即可(考点) | |
50 | + | ``` | |
51 | + | dockerfile test | |
52 | + | ``` |
admin 修订了这个 Gist . 跳至此修订
1 file changed, 11 insertions
h1(file created)
@@ -0,0 +1,11 @@ | |||
1 | + | 打开终端ssh链接后,首先修改镜像源 | |
2 | + | ``` | |
3 | + | vim /etc/docker/daemon.json | |
4 | + | ||
5 | + | { | |
6 | + | "registry-mirrors": [ | |
7 | + | "https://docker.1panel.live" | |
8 | + | ] | |
9 | + | } | |
10 | + | ``` | |
11 | + |