中标麒麟 docker安装及运行第一个实例

本文提供了一步步在中标麒麟系统上安装Docker20.10.7的教程,包括下载安装包、解压、移动到/usr/bin目录、注册服务、设置daemon.json、更改虚拟机网络模式、关闭防火墙以及启动和验证Docker服务的过程。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

一、下载安装包,选择适合版本,本次安装选择20.10.7

Index of linux/static/stable/x86_64/

二、安装

    1、将下载的安装文件进行解压,命令如下

tar -xzf docker-20.10.7.tar


    2、将上述解压后文件(docker文件夹)全部移动至/usr/bin目录下(必须),命令如下

 mv docker/* /usr/bin/


    3、注册docker.service服务

vi /usr/lib/systemd/system/docker.service
[Unit]
Description=Docker Application Container Engine
Documentation=https://docs.docker.com
After=network-online.target firewalld.service
Wants=network-online.target

[Service]
Type=notify
# the default is not to use systemd for cgroups because the delegate issues still
# exists and systemd currently does not support the cgroup feature set required
# for containers run by docker
ExecStart=/usr/bin/dockerd 
ExecReload=/bin/kill -s HUP $MAINPID
# Having non-zero Limit*s causes performance problems due to accounting overhead
# in the kernel. We recommend using cgroups to do container-local accounting.
LimitNOFILE=infinity
LimitNPROC=infinity
LimitCORE=infinity
# Uncomment TasksMax if your systemd version supports it.
# Only systemd 226 and above support this version.
#TasksMax=infinity
TimeoutStartSec=0
# set delegate yes so that systemd does not reset the cgroups of docker containers
Delegate=yes
# kill only the docker process, not all processes in the cgroup
KillMode=process
# restart the docker process if it exits prematurely
Restart=on-failure
StartLimitBurst=3
StartLimitInterval=60s

[Install]
WantedBy=multi-user.target

4、添加可执行权限:

chmod +x /usr/lib/systemd/system/docker.service
 
systemctl daemon-reload

5、编辑daemon.json

vi /etc/docker/daemon.json
#找一个阿里云的私库
{
  "registry-mirrors": ["https://xxx.mirror.aliyuncs.com"]
}
systemctl daemon-reload

6、将中标麒麟虚拟机改为桥接模式(不是虚拟机不需要)

 7、关闭防火墙(非常重要,不然无法启动)


systemctl disable firewalld

chkconfig iptables off

8、启动docker

systemctl start docker.service

9、查看docker状态

三、运行第一个实例 helloworld

1、从仓库拉取  helloworld

2、运行

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值