docker和docker-compose便捷安装

安装docker:
curl -fsSL get.docker.com -o get-docker.sh&&sh get-docker.sh 

或:
curl -sSL https://get.docker.com/ | sh

测试
 sudo docker run hello-world
安装docker-compose

下载1
sudo pip install docker-compose

下载2
sudo curl -L https://get.daocloud.io/docker/compose/releases/download/1.25.1/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
sudo curl -L https://github.com/docker/compose/releases/download/1.16.1/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose

添加执行权限
sudo chmod +x /usr/local/bin/docker-compose

测试
$ docker-compose --version
 

 

参考链接:https://huaweicloud.csdn.net/62a2fa6078f1bc4bebc13cab.html

参考链接:https://huaweicloud.csdn.net/62a2fa6078f1bc4bebc13cab.html

 

附:

报错:Devices cgroup isn‘t mounted

分析:cgroup未挂载

解决:将cgroup挂载上即可

一键检查挂载脚本:

set -e   
# 这句是告诉bash如何有任何语句执行结果不为ture,就应该退出。 

if grep -v '^#' /etc/fstab | grep -q cgroup; then
    echo 'cgroups mounted from fstab, not mounting /sys/fs/cgroup'
    exit 0
fi

# kernel provides cgroups?
if [ ! -e /proc/cgroups ]; then
    exit 0
fi

# 确保目录存在
if [ ! -d /sys/fs/cgroup ]; then
    exit 0
fi

# mount /sys/fs/cgroup if not already done
if ! mountpoint -q /sys/fs/cgroup; then
    mount -t tmpfs -o uid=0,gid=0,mode=0755 cgroup /sys/fs/cgroup
fi

cd /sys/fs/cgroup

# get/mount list of enabled cgroup controllers
for sys in $(awk '!/^#/ { if ($4 == 1) print $1 }' /proc/cgroups); do
    mkdir -p $sys
    if ! mountpoint -q $sys; then
        if ! mount -n -t cgroup -o $sys cgroup $sys; then
            rmdir $sys || true
        fi
    fi
done


exit 0
View Code

结果核对

 

 

参考链接:https://blog.csdn.net/xinshuzhan/article/details/118293022

 

posted @ 2022-08-11 11:50  咿呀哒喏  阅读(113)  评论(0编辑  收藏  举报