Ubuntu 20.04 上安装和使用 Docker的详细过程(安装包)

作者:久末丶 时间:2021-11-30 08:49:19 

安装前将所有的软件包上传到系统的/opt路径,所有的操作都在/opt目录下

一、解压文件

tar -xzvf docker-19.03.0.tgz

二、拷贝解压后的文件到/usr/bin/下面

cp docker/* /usr/bin/

三、加入系统文件

cat >/etc/systemd/system/docker.service <<-EOF
[Unit]
Description=Docker Application Container Engine
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 -H tcp://0.0.0.0:2375 -H unix://var/run/docker.sock
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
EOF

四、启动Docker

systemctl daemon-reload && systemctl start docker && systemctl enable docker.service

五、Docker配置文件

编辑daemon.json文件输入以下内容

vim /etc/docker/daemon.json
{
   "log-driver":"json-file",
   "log-opts":{
       "max-size" :"10m","max-file":"4"
   },
   "registry-mirrors": ["https://6kx4zyno.mirror.aliyuncs.com"]
}

六、重启Docker

systemctl restart docker

七、检查Docker是否安装成功

docker --version

八、总结

我们已经向你展示如何在 Ubuntu 20.04 机器上安装 Docker。

想要学习更多关于 Docker 的信息,查阅官方 Docker 文档。

来源:https://www.cnblogs.com/jiumo/p/15958437.html

标签:Ubuntu,20.04,Docker
0
投稿

猜你喜欢

  • 谈谈做网站的心态

    2008-11-24 14:49:00
  • 被封网站应该如何解救

    2009-02-01 11:15:00
  • 配置记录FTP传输情况的Linux FTP服务器

    2009-02-18 15:34:00
  • 中国大型网游用户数达6931万 休闲游戏猛增

    2009-11-27 12:29:00
  • 网络视频广告与用户体验

    2007-09-18 12:30:00
  • 谷歌AdWords五千万激励计划11月30日结束

    2009-11-26 11:09:00
  • IE8与IE7共存的两种方法

    2008-03-17 13:23:00
  • 新浪管理层1.8亿美元自购成最大股东

    2009-09-29 08:01:00
  • 在Firefox下自定义个性化Autoscroll图标

    2008-01-04 11:44:00
  • 分享:DEDECMS程序首页整合优化

    2012-11-05 21:30:59
  • 寻找人生的升华点 程序员的5000元大关

    2009-08-29 09:31:00
  • SEO放弃无效的收录,我要和你PK热门关键字

    2008-06-29 14:59:00
  • 验证码的故事

    2010-08-09 12:48:00
  • Vmware虚拟机设置固定IP地址的方法( 图文教程)

    2022-09-30 05:15:25
  • Apache的status相关问题解决办法

    2022-07-30 12:16:10
  • 在Windows Server 2003中为Web站点配置DNS记录

    2007-12-24 10:00:00
  • 27家主流媒体对微软Windows7评论大汇集

    2009-10-23 09:41:00
  • QQ邮箱将限量推出vip邮箱帐号注册

    2008-01-18 12:49:00
  • Linux下ZooKeeper分布式集群安装教程

    2023-02-14 01:54:03
  • 动视暴雪《使命召唤6》游戏或遭俄罗斯封杀

    2009-11-17 07:59:00
  • asp之家 网站运营 m.aspxhome.com