@@ -293,6 +293,29 @@ <h2 id="镜像管理"><a aria-hidden="true" tabindex="-1" href="#镜像管理" c
293293
294294# 连接进行进入命令行模式,exit命令退出。
295295docker run -t -i nginx:latest /bin/bash
296+ "> < div onclick ="copied(this) " class ="copied "> < svg class ="octicon-copy " aria-hidden ="true " viewBox ="0 0 16 16 " fill ="currentColor " height ="12 " width ="12 "> < path fill-rule ="evenodd " d ="M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 010 1.5h-1.5a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-1.5a.75.75 0 011.5 0v1.5A1.75 1.75 0 019.25 16h-7.5A1.75 1.75 0 010 14.25v-7.5z "> </ path > < path fill-rule ="evenodd " d ="M5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0114.25 11h-7.5A1.75 1.75 0 015 9.25v-7.5zm1.75-.25a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-7.5a.25.25 0 00-.25-.25h-7.5z "> </ path > </ svg > < svg class ="octicon-check " aria-hidden ="true " viewBox ="0 0 16 16 " fill ="currentColor " height ="12 " width ="12 "> < path fill-rule ="evenodd " d ="M13.78 4.22a.75.75 0 010 1.06l-7.25 7.25a.75.75 0 01-1.06 0L2.22 9.28a.75.75 0 011.06-1.06L6 10.94l6.72-6.72a.75.75 0 011.06 0z "> </ path > </ svg > </ div > </ pre >
297+ < h2 id ="下载镜像本地安装镜像 "> < a aria-hidden ="true " tabindex ="-1 " href ="#下载镜像本地安装镜像 " class ="anchor "> < span class ="icon icon-link "> </ span > </ a > 下载镜像本地安装镜像</ h2 >
298+ < p > 由于国区已经无法访问,可以将镜像打包,直接安装镜像压缩文件</ p >
299+ < pre class ="language-sh "> < code class ="language-sh code-highlight "> < span class ="code-line line-number " line ="1 "> $ < span class ="token function "> docker</ span > pull gitlab/gitlab-ce:17.0.1-ce.0 < span class ="token comment "> # 下载镜像</ span >
300+ </ span > < span class ="code-line line-number " line ="2 "> < span class ="token comment "> # 保存 Docker 镜像到本地文件</ span >
301+ </ span > < span class ="code-line line-number " line ="3 "> $ < span class ="token function "> docker</ span > save < span class ="token parameter variable "> -o</ span > < span class ="token punctuation "> [</ span > output-file.tar< span class ="token punctuation "> ]</ span > < span class ="token punctuation "> [</ span > image-name< span class ="token punctuation "> ]</ span >
302+ </ span > < span class ="code-line line-number " line ="4 "> $ < span class ="token function "> docker</ span > save < span class ="token parameter variable "> -o</ span > gitlab-ce-17.0.1.tar gitlab/gitlab-ce
303+ </ span > </ code > < input type ="hidden " value ="$ docker pull gitlab/gitlab-ce:17.0.1-ce.0 # 下载镜像
304+ # 保存 Docker 镜像到本地文件
305+ $ docker save -o [output-file.tar] [image-name]
306+ $ docker save -o gitlab-ce-17.0.1.tar gitlab/gitlab-ce
307+ "> < div onclick ="copied(this) " class ="copied "> < svg class ="octicon-copy " aria-hidden ="true " viewBox ="0 0 16 16 " fill ="currentColor " height ="12 " width ="12 "> < path fill-rule ="evenodd " d ="M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 010 1.5h-1.5a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-1.5a.75.75 0 011.5 0v1.5A1.75 1.75 0 019.25 16h-7.5A1.75 1.75 0 010 14.25v-7.5z "> </ path > < path fill-rule ="evenodd " d ="M5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0114.25 11h-7.5A1.75 1.75 0 015 9.25v-7.5zm1.75-.25a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-7.5a.25.25 0 00-.25-.25h-7.5z "> </ path > </ svg > < svg class ="octicon-check " aria-hidden ="true " viewBox ="0 0 16 16 " fill ="currentColor " height ="12 " width ="12 "> < path fill-rule ="evenodd " d ="M13.78 4.22a.75.75 0 010 1.06l-7.25 7.25a.75.75 0 01-1.06 0L2.22 9.28a.75.75 0 011.06-1.06L6 10.94l6.72-6.72a.75.75 0 011.06 0z "> </ path > </ svg > </ div > </ pre >
308+ < p > 将镜像文件发送到服务器</ p >
309+ < pre class ="language-sh "> < code class ="language-sh code-highlight "> < span class ="code-line line-number " line ="1 "> $ < span class ="token function "> scp</ span > < span class ="token punctuation "> [</ span > output-file.tar< span class ="token punctuation "> ]</ span > < span class ="token punctuation "> [</ span > user< span class ="token punctuation "> ]</ span > @< span class ="token punctuation "> [</ span > server-ip< span class ="token punctuation "> ]</ span > :< span class ="token punctuation "> [</ span > path< span class ="token punctuation "> ]</ span >
310+ </ span > < span class ="code-line line-number " line ="2 "> $ < span class ="token function "> scp</ span > gitlab-ce-17.0.1.tar root@110.55.8.163:/home/docker-images
311+ </ span > </ code > < input type ="hidden " value ="$ scp [output-file.tar] [user]@[server-ip]:[path]
312+ $ scp gitlab-ce-17.0.1.tar root@110.55.8.163:/home/docker-images
313+ "> < div onclick ="copied(this) " class ="copied "> < svg class ="octicon-copy " aria-hidden ="true " viewBox ="0 0 16 16 " fill ="currentColor " height ="12 " width ="12 "> < path fill-rule ="evenodd " d ="M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 010 1.5h-1.5a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-1.5a.75.75 0 011.5 0v1.5A1.75 1.75 0 019.25 16h-7.5A1.75 1.75 0 010 14.25v-7.5z "> </ path > < path fill-rule ="evenodd " d ="M5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0114.25 11h-7.5A1.75 1.75 0 015 9.25v-7.5zm1.75-.25a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-7.5a.25.25 0 00-.25-.25h-7.5z "> </ path > </ svg > < svg class ="octicon-check " aria-hidden ="true " viewBox ="0 0 16 16 " fill ="currentColor " height ="12 " width ="12 "> < path fill-rule ="evenodd " d ="M13.78 4.22a.75.75 0 010 1.06l-7.25 7.25a.75.75 0 01-1.06 0L2.22 9.28a.75.75 0 011.06-1.06L6 10.94l6.72-6.72a.75.75 0 011.06 0z "> </ path > </ svg > </ div > </ pre >
314+ < p > 服务器上加载 Docker 镜像</ p >
315+ < pre class ="language-sh "> < code class ="language-sh code-highlight "> < span class ="code-line line-number " line ="1 "> $ < span class ="token function "> docker</ span > load < span class ="token parameter variable "> -i</ span > /home/docker-images/gitlab-ce-17.0.1.tar < span class ="token comment "> # 加载 Docker 镜像</ span >
316+ </ span > < span class ="code-line line-number " line ="2 "> $ < span class ="token function "> docker</ span > images < span class ="token comment "> # 验证镜像是否加载成功</ span >
317+ </ span > </ code > < input type ="hidden " value ="$ docker load -i /home/docker-images/gitlab-ce-17.0.1.tar # 加载 Docker 镜像
318+ $ docker images # 验证镜像是否加载成功
296319 "> < div onclick ="copied(this) " class ="copied "> < svg class ="octicon-copy " aria-hidden ="true " viewBox ="0 0 16 16 " fill ="currentColor " height ="12 " width ="12 "> < path fill-rule ="evenodd " d ="M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 010 1.5h-1.5a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-1.5a.75.75 0 011.5 0v1.5A1.75 1.75 0 019.25 16h-7.5A1.75 1.75 0 010 14.25v-7.5z "> </ path > < path fill-rule ="evenodd " d ="M5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0114.25 11h-7.5A1.75 1.75 0 015 9.25v-7.5zm1.75-.25a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-7.5a.25.25 0 00-.25-.25h-7.5z "> </ path > </ svg > < svg class ="octicon-check " aria-hidden ="true " viewBox ="0 0 16 16 " fill ="currentColor " height ="12 " width ="12 "> < path fill-rule ="evenodd " d ="M13.78 4.22a.75.75 0 010 1.06l-7.25 7.25a.75.75 0 01-1.06 0L2.22 9.28a.75.75 0 011.06-1.06L6 10.94l6.72-6.72a.75.75 0 011.06 0z "> </ path > </ svg > </ div > </ pre >
297320 < h3 id ="通过容器创建镜像 "> < a aria-hidden ="true " tabindex ="-1 " href ="#通过容器创建镜像 " class ="anchor "> < span class ="icon icon-link "> </ span > </ a > 通过容器创建镜像</ h3 >
298321 < p > 我们可以通过以下两种方式对镜像进行更改。</ p >
@@ -972,7 +995,8 @@ <h2 id="license"><a aria-hidden="true" tabindex="-1" href="#license" class="anch
972995 < li > < a href ="#旧版本安装 " class ="tocs-link "> 旧版本安装</ a > </ li >
973996 < li > < a href ="#命令介绍 " class ="tocs-link "> 命令介绍</ a > </ li >
974997 < li > < a href ="#服务管理 " class ="tocs-link "> 服务管理</ a > </ li >
975- < li > < a href ="#镜像管理 " class ="tocs-link "> 镜像管理</ a >
998+ < li > < a href ="#镜像管理 " class ="tocs-link "> 镜像管理</ a > </ li >
999+ < li > < a href ="#下载镜像本地安装镜像 " class ="tocs-link "> 下载镜像本地安装镜像</ a >
9761000 < ol class ="tocs-list is-collapsed ">
9771001 < li > < a href ="#通过容器创建镜像 " class ="tocs-link "> 通过容器创建镜像</ a > </ li >
9781002 < li > < a href ="#通过dockerfile创建镜像 " class ="tocs-link "> 通过Dockerfile创建镜像</ a > </ li >
0 commit comments