1.卸载旧版刀客改为玩客云设计只有玩客云能够运行
使用以下命令逐个运行一个个运行删除docker
bash
sudo systemctl stop docker
sudo apt-get purge docker-ce docker-ce-cli containerd.io
yum remove docker-ce docker-ce-cli containerd.io
sudo rm -rf /var/lib/docker
sudo rm -rf /etc/docker
sudo rm -rf /var/run/docker.sock
sudo groupdel docker
bash
for pkg in docker.io docker-doc docker-compose docker-compose-v2 podman-docker containerd runc; do sudo apt-get remove $pkg; done
bash
sudo apt-get purge docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin docker-ce-rootless-extras
bash
sudo apt-get purge docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin docker-ce-rootless-extras
bash
sudo rm -rf /var/lib/docker
sudo rm -rf /var/lib/containerd
bash
sudo rm /etc/apt/sources.list.d/docker.list
sudo rm /etc/apt/keyrings/docker.asc
2.修复或安装docker
docker安装
bash
# ubuntu
sudo apt-get remove docker docker-engine docker.io containerd runc
sudo apt-get update
sudo apt-get install \\
ca-certificates \\
curl \\
gnupg
sudo install -m 0755 -d /etc/apt/keyrings
curl -fsSL <https://download.docker.com/linux/ubuntu/gpg> | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
sudo chmod a+r /etc/apt/keyrings/docker.gpg
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
Docker Compose 安装
bash
sudo curl -L "<https://github.com/docker/compose/releases/download/1.25.0/docker-compose-$>(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
docker-compose --version
配置优化
大多数时候,我们的vps磁盘空间不会太大,如果是使用docker 服务,为了能够有效控制docker日志大小,需要根据自己需求如下调整以防止过多日志导致磁盘用满。
/etc/docker/daemon.json
bash
{
"log-driver": "json-file",
"log-opts": {
"max-size": "1m",
"max-file": "1"
}
}
docker命令
bash
启动和校验 常用操作
# 启动Docker
systemctl start docker
# 停止Docker
systemctl stop docker
# 重启
systemctl restart docker
# 设置开机自启
systemctl enable docker
自行搜索如何更改docker更改为国内镜像源
如果不会安装docker的可以使用1panl玩客云
bash
curl -sSL https://resource.fit2cloud.com/1panel/package/quick_start.sh -o quick_start.sh && sudo bash quick_start.sh
以下是一些常用的Docker镜像仓库地址:12
Docker Hub:这是最常用的Docker镜像仓库,提供了大量的官方和社区镜像。
阿里云容器镜像服务:https://cr.console.aliyun.com/
中国科技大学镜像站:https://docker.mirrors.ustc.edu.cn
网易镜像仓库:http://hub-mirror.c.163.com
DaoCloud:https://hub.daocloud.io
Azure中国镜像:http://mirror.azure.cn
1、阿里云镜像站:(需登录,免费)https://<your_code>.mirror.aliyuncs.com2、网易云镜像站:
bash
casaos-uninstall
3、百度云镜像站:https://mirror.baidubce.com
4、上海交大镜像站:https://docker.mirrors.sjtug.sjtu.edu.cn
5、南京大学镜像站:https://docker.nju.edu.cn
1panldocker机枪员配置好了以后卸载1panl此过程不会卸载docker以下命令逐个运行
bash
sudo systemctl stop 1panel
sudo 1pctl uninstall
sudo rm -rf /var/lib/1panel /etc/1panel /usr/local/bin/1pctl
sudo journalctl --vacuum-time=3d
#验证1panl是否卸载
sudo systemctl list-unit-files | grep 1panel
3.casaos安装与卸载
casaos安装
bash
curl -fsSL https://get.casaos.io | sudo bash
验证是否安装成功和查看版本
bash
casaos -v
casaos更新命令
bash
curl -fsSL https://get.casaos.io/update | sudo bash
casaos卸载命令
bash
casaos-uninstall