您当前的位置:首页 > 网站建设 > 网站维护
| php | asp | css | H5 | javascript | Mysql | Dreamweaver | Delphi | 网站维护 | 帝国cms | React | 考试系统 | ajax | jQuery |

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

51自学网 2022-07-22 18:50:38
  网站维护

安装前将所有的软件包上传到系统的/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 EngineAfter=network-online.target firewalld.serviceWants=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 dockerExecStart=/usr/bin/dockerd -H tcp://0.0.0.0:2375 -H unix://var/run/docker.sockExecReload=/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=infinityLimitNPROC=infinityLimitCORE=infinity# Uncomment TasksMax if your systemd version supports it.# Only systemd 226 and above support this version.#TasksMax=infinityTimeoutStartSec=0# set delegate yes so that systemd does not reset the cgroups of docker containersDelegate=yes# kill only the docker process, not all processes in the cgroupKillMode=process# restart the docker process if it exits prematurelyRestart=on-failureStartLimitBurst=3StartLimitInterval=60s[Install]WantedBy=multi-user.targetEOF

四、启动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 文档


下载地址:
Docker&nbsp;Portainer&nbsp;可视化面板的使用
Docker搭建Jenkins并自动化打包部署项目的步骤
51自学网,即我要自学网,自学EXCEL、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。
京ICP备13026421号-1