第三周第二次记录

React 系列八:非父子组件通信

  返回  

离线安装docker和docker-compose

2021/7/21 12:28:56 浏览:

Linux下离线安装Docker最新版本

1、下载

wget https://download.docker.com/linux/static/stable/x86_64/docker-18.06.1-ce.tgz

2、解压

tar -xvf docker-18.06.1-ce.tgz

3、将解压出来的docker文件内容移动到 /usr/bin/ 目录下

cp docker/* /usr/bin/

4、将docker注册为service

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

5、启动

chmod +x /etc/systemd/system/docker.service #添加文件权限并启动docker
 
systemctl daemon-reload                 #重新加载配置文件
systemctl start docker                  #启动Docker
systemctl enable docker.service         #设置开机自启

6、验证

systemctl status docker         #查看Docker状态
docker -v                       #查看Docker版本

离线安装docker-compose

(1)首先访问 docker-compose 的 GitHub 版本发布页面:
https://github.com/docker/compose/releases

(2)由于服务器是 CentOS 系统,则下载 Linux 版本的 Compose:

在这里插入图片描述

3)将下载下来的“docker-compose-Linux-x86_64”文件上传到服务器上,然后执行如下命令将其移动到 /usr/local/bin,并改名为“docker-compose”。
1
sudo mv docker-compose-Linux-x86_64 /usr/local/bin/docker-compose

(4)接着执行如下命令添加可执行权限:
1
sudo chmod +x /usr/local/bin/docker-compose

(5)最后使用 docker-compose -v 命令测试是否安装成功(如果提示“没有那个文件或目录”可以重启下服务器再试试):
原文:Docker - 离线安装 docker-compose(以CentOS系统为例)

联系我们

如果您对我们的服务有兴趣,请及时和我们联系!

服务热线:18288888888
座机:18288888888
传真:
邮箱:888888@qq.com
地址:郑州市文化路红专路93号