Ubuntu 20.04 上安装和使用 Docker的详细过程(安装包)
目录
- 一、解压文件
- 二、拷贝解压后的文件到/usr/bin/下面
- 三、加入系统文件
- 四、启动Docker
- 五、Docker配置文件
- 六、重启Docker
- 七、检查Docker是否安装成功
- 八、总结
安装前将所有的软件包上传到系统的/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 文档。
上一篇:Zabbix SAML SSO 登录绕过漏洞的操作流程
栏 目:其它服务器
下一篇:windows server 2012 r2 服务器部署tp6 项目
本文标题:Ubuntu 20.04 上安装和使用 Docker的详细过程(安装包)
本文地址:https://zz.feitang.co/server/32068.html
您可能感兴趣的文章
- 01-06nginx从安装到配置详细说明(安装,安全配置,防盗链,动静分离,配置 HTTPS,性能优化)
- 01-06Nginx性能优化之Gzip压缩设置详解(最大程度提高页面打开速度)
- 01-06Linux系统 Centos7.4手动在线升级到Centos7.7
- 01-06详解nginx安装过程并代理下载服务器文件
- 01-06shell脚本根据进程查找指定容器的方法
- 01-06微服务架构拆分策略详解
- 01-06使用 Apache Dubbo 实现远程通信(微服务架构)
- 01-06微服务架构之服务注册与发现功能详解
- 01-06使用Zabbix 5.4.3监控IPMI的方法
- 01-06微服务架构之服务注册与发现实践示例详解






