十年网站开发经验 + 多家企业客户 + 靠谱的建站团队
量身定制 + 运营维护+专业推广+无忧售后,网站问题一站解决
这期内容当中小编将会给大家带来有关Docker如何实现在线与离线安装,文章内容丰富且以专业的角度为大家分析和叙述,阅读完这篇文章希望大家可以有所收获。
成都创新互联是一家专注于成都做网站、成都网站制作、成都外贸网站建设与策划设计,辉南网站建设哪家好?成都创新互联做网站,专注于网站建设十多年,网设计领域的专业建站公司;建站业务涵盖:辉南等地区。辉南做网站价格咨询:13518219792这里采用yum源命令安装前期准备的依赖包,包括yum-utils、device-mapper-persistent-data、lvm2
sudo yum install -y yum-utils device-mapper-persistent-data lvm2
因为官方镜像仓库网速较慢,在此设置阿里云镜像代理,以便快速下载、上传镜像。
sudo yum-config-manager --add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
接下来安装Docker-CE 社区版,通过以下命令查看docker社区版安装包列表。如下图所示各docker版本信息。
yum list docker-ce --showduplicates | sort -r
选择对应版本安装docker
sudo yum install docker-ce.x86_64
启动
sudo systemctl enable docker
sudo systemctl start docker
验证:查看版本信息命令,出现下图时表明安装成功。
docker version
提供以下三种方式下载docker离线安装包
Docker官方地址:docker down
1.百度云下载地址: https://pan.baidu.com/s/1tZpsOvY0wmCfwHXlNJuq8Q 提取码: rhaq
2.有网服务器执行命令下载:wget https://download.docker.com/linux/static/stable/x86_64/docker-18.09.6.tgz
3.官方参考文档:https://docs.docker.com/install/linux/docker-ce/binaries/#install-static-binaries
将已下载好的docker离线包拷贝到服务器,解压压缩包
tar -xvf docker-18.09.6.tgz
将解压出来的docker文件内容移动到 /usr/bin/ 目录下
cp docker/* /usr/bin/
注册编辑docker服务
vim /etc/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