目录
10.安装完docker-compose结果没有命令缺少环境变量
🌐 无论你是初学者还是经验丰富的专家,都能在这里找到志同道合的朋友,一起进步,共同探索运维领域的各种挑战和机遇。
1. 查看系统信息
2.网盘获取安装包
链接:https://pan.baidu.com/s/18DWv56wGW8xaJ9oR0Qxxuw
提取码:0124
--来自百度网盘超级会员V3的分享
3.安装
tar xf 包名
cd dpcker
./install.sh install
卸载
./install.sh uninstall
4.自定义安装版本
5.下载docker离线安装包
https://download.docker.com/linux/static/stable/
6.下载 docker-compose离线包
https://github.com/docker/compose/releases
7.编辑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
8.安装docker-compose
# 进入安装文件存放目录
cd /home/soft
# 解压 docker 到当前目录
tar -xvf docker-20.10.7.tgz
# 将 docker 文件移动到 /usr/bin 目录下
cp -p docker/* /usr/bin
# 将 docker-compose 文件复制到 /usr/local/bin/ 目录下,并重命名为 docker-compose
cp docker-compose-linux-aarch64 /usr/local/bin/docker-compose
# 设置 docker-compose 文件权限
chmod +x /usr/local/bin/docker-compose
# 将 docker.service 移到 /etc/systemd/system/ 目录
cp docker.service /etc/systemd/system/
# 设置 docker.service 文件权限
chmod +x /etc/systemd/system/docker.service
# 重新加载配置文件
systemctl daemon-reload
# 启动docker
systemctl start docker
# 设置 docker 开机自启
systemctl enable docker.service
9.遇问题总结
10.安装完docker-compose结果没有命令缺少环境变量
which docker-compose
11.添加变量
sudo vi ~/.bashrc
export PATH=$PATH:/usr/local/bin
source ~/.bashrc