Docker:银河麒麟系统/Ubuntu/arm64-离线安装Docker,配置自启
<h3><span style="font-size: 18px"><strong>下载离线包</strong></span></h3><p><span style="font-size: 16px"><strong>离线安装包地址:https://download.docker.com/linux/debian/dists/stretch/pool/stable/</strong></span></p>
<p><span style="font-size: 16px"><strong><img src="https://img2020.cnblogs.com/blog/1582099/202007/1582099-20200707161611568-1413050060.png" alt=""></strong></span></p>
<p><span style="font-size: 16px; color: rgba(255, 0, 0, 1)"><strong>注意:</strong></span></p>
<p><span style="font-size: 16px; color: rgba(255, 0, 0, 1)"><strong>amd64是处理器64位 复杂指令集版本!(一般我们用的都是这个!)</strong></span></p>
<p><span style="font-size: 16px; color: rgba(255, 0, 0, 1)"><strong>arm64/aarch64 是处理器64位 精简指令集版本!(个别公司使用这个!)</strong></span></p>
<p><span style="font-size: 16px"><strong>查看cpu位数</strong></span></p>
<div class="cnblogs_code">
<pre><span style="color: rgba(0, 0, 0, 1)">#查看位数信息
arch</span></pre>
</div>
<h3><span style="font-size: 16px"><strong>安装docker</strong></span></h3>
<div class="cnblogs_code">
<pre><span style="color: rgba(0, 0, 0, 1)">#安装命令(.deb是你下载的文件)
dpkg </span>-i docker-ce_18.<span style="color: rgba(128, 0, 128, 1)">06.3</span>~ce~<span style="color: rgba(128, 0, 128, 1)">3</span>-<span style="color: rgba(128, 0, 128, 1)">0</span>~debian_arm64.deb</pre>
</div>
<h3><span style="font-size: 16px"><strong>如果报错</strong></span></h3>
<div class="cnblogs_code">
<pre>root@greatwall-os:/home/soft# dpkg -i docker-ce_18.<span style="color: rgba(128, 0, 128, 1)">06</span>.3_ce_3-<span style="color: rgba(0, 0, 0, 1)">0_debian_arm64.deb
dpkg:警告:即将把 docker</span>-ce 从 <span style="color: rgba(128, 0, 128, 1)">5</span>:<span style="color: rgba(128, 0, 128, 1)">18.09</span>.<span style="color: rgba(128, 0, 128, 1)">7</span>~<span style="color: rgba(128, 0, 128, 1)">3</span>-<span style="color: rgba(128, 0, 128, 1)">0</span>~debian-stretch 降级到 <span style="color: rgba(128, 0, 128, 1)">18.06</span>.<span style="color: rgba(128, 0, 128, 1)">3</span>~ce~<span style="color: rgba(128, 0, 128, 1)">3</span>-<span style="color: rgba(128, 0, 128, 1)">0</span>~<span style="color: rgba(0, 0, 0, 1)">debian
(正在读取数据库 ... 系统当前共安装有 </span><span style="color: rgba(128, 0, 128, 1)">200104</span><span style="color: rgba(0, 0, 0, 1)"> 个文件和目录。)
正准备解包 docker</span>-ce_18.<span style="color: rgba(128, 0, 128, 1)">06</span>.3_ce_3-<span style="color: rgba(0, 0, 0, 1)">0_debian_arm64.deb...
正在将 docker</span>-ce (<span style="color: rgba(128, 0, 128, 1)">18.06</span>.<span style="color: rgba(128, 0, 128, 1)">3</span>~ce~<span style="color: rgba(128, 0, 128, 1)">3</span>-<span style="color: rgba(128, 0, 128, 1)">0</span>~debian) 解包到 (<span style="color: rgba(128, 0, 128, 1)">5</span>:<span style="color: rgba(128, 0, 128, 1)">18.09</span>.<span style="color: rgba(128, 0, 128, 1)">7</span>~<span style="color: rgba(128, 0, 128, 1)">3</span>-<span style="color: rgba(128, 0, 128, 1)">0</span>~debian-<span style="color: rgba(0, 0, 0, 1)">stretch) 上 ...
dpkg: 依赖关系问题使得 docker</span>-<span style="color: rgba(0, 0, 0, 1)">ce 的配置工作不能继续:
docker</span>-ce 依赖于 libseccomp2 (>= <span style="color: rgba(128, 0, 128, 1)">2.3</span>.<span style="color: rgba(128, 0, 128, 1)">0</span><span style="color: rgba(0, 0, 0, 1)">);然而:
系统中 libseccomp2:arm64 的版本为 </span><span style="color: rgba(128, 0, 128, 1)">2.2</span>.<span style="color: rgba(128, 0, 128, 1)">3</span>-<span style="color: rgba(0, 0, 0, 1)">3kord3。
dpkg: 处理软件包 docker</span>-ce (--<span style="color: rgba(0, 0, 255, 1)">install</span><span style="color: rgba(0, 0, 0, 1)">)时出错:
依赖关系问题 </span>-<span style="color: rgba(0, 0, 0, 1)"> 仍未被配置
正在处理用于 ureadahead (</span><span style="color: rgba(128, 0, 128, 1)">0.100</span>.<span style="color: rgba(128, 0, 128, 1)">0</span>-<span style="color: rgba(0, 0, 0, 1)">19kord) 的触发器 ...
正在处理用于 systemd (</span><span style="color: rgba(128, 0, 128, 1)">229</span>-<span style="color: rgba(0, 0, 0, 1)">4kord4k16) 的触发器 ...
正在处理用于 </span><span style="color: rgba(0, 0, 255, 1)">man</span>-db (<span style="color: rgba(128, 0, 128, 1)">2.7</span>.<span style="color: rgba(128, 0, 128, 1)">5</span>-<span style="color: rgba(0, 0, 0, 1)">1kord) 的触发器 ...
在处理时有错误发生:
docker</span>-ce</pre>
</div>
<p><span style="font-size: 16px"><strong>原因是:libltdl7 libseccomp2版本太低,需要安装高版本。</strong></span></p>
<p><span style="font-size: 16px"><strong>1.联网</strong></span></p>
<div class="cnblogs_code">
<pre> apt-get <span style="color: rgba(0, 0, 255, 1)">install</span> -y libltdl7 libseccomp2</pre>
</div>
<p><span style="font-size: 16px"><strong>2.离线</strong></span></p>
<p><span style="font-size: 16px"><strong>地址:http://ftp.sjtu.edu.cn/ubuntu/pool/main/libs/libseccomp/</strong></span></p>
<div class="cnblogs_code">
<pre><span style="color: rgba(0, 0, 0, 1)">#安装命令
dpkg </span>-i libltdl7_2.<span style="color: rgba(128, 0, 128, 1)">4.6</span>-<span style="color: rgba(128, 0, 128, 1)">0</span>.1_arm64.deb</pre>
</div>
<p><span style="font-size: 16px"><strong>重新安装</strong></span></p>
<div class="cnblogs_code">
<pre><span style="color: rgba(0, 0, 0, 1)">#安装
dpkg </span>-i docker-ce_18.<span style="color: rgba(128, 0, 128, 1)">06.3</span>~ce~<span style="color: rgba(128, 0, 128, 1)">3</span>-<span style="color: rgba(128, 0, 128, 1)">0</span>~debian_arm64.deb</pre>
</div>
<p><span style="font-size: 16px"><strong>启动命令</strong></span></p>
<div class="cnblogs_code">
<pre><span style="color: rgba(0, 0, 0, 1)">#启动
systemctl start docker</span></pre>
</div>
<p><span style="font-size: 16px"><strong>停止命令</strong></span></p>
<div class="cnblogs_code">
<pre><span style="color: rgba(0, 0, 0, 1)">#停止命令
systemctl stop docker</span></pre>
</div>
<p><span style="font-size: 16px"><strong>卸载命令</strong></span></p>
<div class="cnblogs_code">
<pre><span style="color: rgba(0, 0, 0, 1)">#卸载docker
apt</span>-get remove docker</pre>
</div>
<h3><span style="font-size: 18px"><strong> 配置开机自启</strong></span></h3>
<p><strong><span style="font-size: 16px">编辑一个Docker的系统服务文件</span></strong></p>
<div class="cnblogs_code">
<pre><span style="color: rgba(0, 0, 0, 1)">#生成docker.service文件
</span><span style="color: rgba(0, 0, 255, 1)">vi</span> /usr/lib/systemd/system/docker.service</pre>
</div>
<p><span style="font-size: 16px"><strong>添加如下内容</strong></span></p>
<div class="cnblogs_code">
<pre><span style="color: rgba(0, 0, 0, 1)">
Description</span>=<span style="color: rgba(0, 0, 0, 1)">Docker Application Container Engine
Documentation</span>=https:<span style="color: rgba(0, 128, 0, 1)">//</span><span style="color: rgba(0, 128, 0, 1)">docs.docker.com</span>
After=network-<span style="color: rgba(0, 0, 0, 1)">online.target firewalld.service
Wants</span>=network-<span style="color: rgba(0, 0, 0, 1)">online.target
Type</span>=<span style="color: rgba(0, 0, 0, 1)">notify
EnvironmentFile</span>=-/etc/sysconfig/<span style="color: rgba(0, 0, 0, 1)">docker
EnvironmentFile</span>=-/etc/sysconfig/docker-<span style="color: rgba(0, 0, 0, 1)">storage
EnvironmentFile</span>=-/etc/sysconfig/docker-<span style="color: rgba(0, 0, 0, 1)">network
Environment</span>=GOTRACEBACK=<span style="color: rgba(0, 0, 0, 1)">crash
ExecStart</span>=/usr/bin/<span style="color: rgba(0, 0, 0, 1)">dockerd $OPTIONS \
$DOCKER_STORAGE_OPTIONS \
$DOCKER_NETWORK_OPTIONS \
$INSECURE_REGISTRY
ExecReload</span>=/bin/<span style="color: rgba(0, 0, 255, 1)">kill</span> -<span style="color: rgba(0, 0, 0, 1)">s HUP $MAINPID
LimitNOFILE</span>=<span style="color: rgba(128, 0, 128, 1)">1048576</span><span style="color: rgba(0, 0, 0, 1)">
LimitNPROC</span>=<span style="color: rgba(128, 0, 128, 1)">1048576</span><span style="color: rgba(0, 0, 0, 1)">
LimitCORE</span>=<span style="color: rgba(0, 0, 0, 1)">infinity
# set delegate yes so that systemd does not reset the cgroups of docker containers
Delegate</span>=<span style="color: rgba(0, 0, 0, 1)">yes
# </span><span style="color: rgba(0, 0, 255, 1)">kill</span> only the docker process, not all processes <span style="color: rgba(0, 0, 255, 1)">in</span><span style="color: rgba(0, 0, 0, 1)"> the cgroup
KillMode</span>=<span style="color: rgba(0, 0, 0, 1)">process
WantedBy</span>=multi-user.target</pre>
</div>
<p><span style="font-size: 16px"><strong>配置生效</strong></span></p>
<div class="cnblogs_code">
<pre><span style="color: rgba(0, 0, 0, 1)">#赋予权限
</span><span style="color: rgba(0, 0, 255, 1)">chmod</span> +x /etc/systemd/system/<span style="color: rgba(0, 0, 0, 1)">docker.service
#配置生效
systemctl daemon</span>-reload</pre>
</div>
<p><span style="font-size: 16px"><strong>配置docker国内源</strong></span></p>
<p><span style="font-size: 16px"><strong>创建或修改 /etc/docker/daemon.json 文件,修改为如下形式</strong></span></p>
<pre class="language-bash highlighter-hljs" data-dark-theme="true"><code>{
"live-restore": true,
"log-driver": "json-file",
"log-opts": {
"max-size":"500m",
"max-file":"3",
"env": "os,customer"
},
"bip": "10.0.1.1/24",
"default-address-pools" : [
{
"base" : "10.0.1.0/16",
"size" : 24
}
],
"registry-mirrors": [
"https://docker-0.unsee.tech",
"https://docker.1ms.run",
"https://docker.xuanyuan.me",
"https://0vrv861z.mirror.aliyuncs.com",
"http://hub-mirror.c.163.com",
"https://docker.mirrors.ustc.edu.cn",
"https://registry.docker-cn.com",
"https://2a6bf1988cb6428c877f723ec7530dbc.mirror.swr.myhuaweicloud.com",
"https://docker.m.daocloud.io",
"https://hub-mirror.c.163.com",
"https://mirror.baidubce.com",
"https://your_preferred_mirror",
"https://dockerhub.icu",
"https://docker.registry.cyou",
"https://docker-cf.registry.cyou",
"https://dockercf.jsdelivr.fyi",
"https://docker.jsdelivr.fyi",
"https://dockertest.jsdelivr.fyi",
"https://mirror.aliyuncs.com",
"https://dockerproxy.com",
"https://mirror.baidubce.com",
"https://docker.m.daocloud.io",
"https://docker.nju.edu.cn",
"https://docker.mirrors.sjtug.sjtu.edu.cn",
"https://docker.mirrors.ustc.edu.cn",
"https://mirror.iscas.ac.cn",
"https://docker.rainbond.cc"
]
}</code></pre>
<p><span style="font-size: 16px"><strong>测试</strong></span></p>
<div class="cnblogs_code">
<pre><span style="color: rgba(0, 0, 0, 1)">#测试启动
systemctl start docker
#配置开机自启
systemctl enable docker</span></pre>
</div>
<p><span style="font-size: 16px"><strong>如果以上命令执行不成功,可以选择其他方案来配置开机自启,没有必要非要解决。</strong></span></p>
<p><span style="font-size: 16px"><strong>将命令添加到rc.local文件,配置开机自启动。</strong></span></p>
<div class="cnblogs_code">
<pre><span style="color: rgba(0, 0, 0, 1)">#将命令添加到rc.local文件中
</span><span style="color: rgba(0, 0, 255, 1)">echo</span> <span style="color: rgba(128, 0, 0, 1)">"</span><span style="color: rgba(128, 0, 0, 1)">systemctl start docker</span><span style="color: rgba(128, 0, 0, 1)">"</span> > /etc/<span style="color: rgba(0, 0, 0, 1)">rc.local
#赋予最大权限
</span><span style="color: rgba(0, 0, 255, 1)">chmod</span> +x /etc/rc.local</pre>
</div>
<p> </p>
<p><span style="font-size: 16px"><strong>文章转载至:https://www.jianshu.com/p/1f0d88db67be、https://blog.csdn.net/fan_ping/article/details/90070124</strong></span></p>
</div>
<div id="MySignature" role="contentinfo">
-----------------------------------
作者:怒吼的萝卜
链接:http://www.cnblogs.com/nhdlb/
-----------------------------------<br><br>
来源:https://www.cnblogs.com/nhdlb/p/13261622.html
頁:
[1]