ubuntu22用apt安装固定docke20.10版本

1. 查看系统版本

root@mqq-virtual-machine:~# lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu Kinetic Kudu (development branch)
Release:	22.10
Codename:	kinetic
root@mqq-virtual-machine:~# 

2. 系统优化基础操作

hostnamectl set-hostname  master && bash
sudo systemctl stop ufw
sudo systemctl disable ufw
sudo apt update
sudo apt-get  -y upgrade

问题处理:

root@master:~# sudo apt-get  -y upgrade #执行这条语句,这里报错
E: Could not get lock /var/lib/dpkg/lock-frontend. It is held by process 2939 (unattended-upgr)
N: Be aware that removing the lock file is not a solution and may break your system.
E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), is another process using it?
root@master:~# 

解决方法:
sudo rm /var/lib/apt/lists/lock
sudo rm /var/cache/apt/archives/lock
sudo rm /var/lib/dpkg/lock*
sudo dpkg --configure -a
sudo apt update
sudo apt-get -y upgrade

问题处理:

root@master:# sudo apt-get -y upgrade
E: Malformed entry 1 in list file /etc/apt/sources.list.d/docker.list (URI parse)
E: The list of sources could not be read.
E: Malformed entry 1 in list file /etc/apt/sources.list.d/docker.list (URI parse)
E: The list of sources could not be read.
root@master:#

解决方法:
cd /etc/apt/sources.list.d
rm -fr docker.list 
sudo apt update
sudo apt-get -y upgrade

3.安装docker

sudo apt update
sudo apt upgrade -y


# 安装 Docker 的依赖项
sudo apt install apt-transport-https ca-certificates curl software-properties-common -y

#添加 Docker 的软件包源
echo "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg]  $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null


# 再次更新资源库
sudo apt-get update

# 开始安装
sudo apt -y install docker.io  #安装docker最新版



# 验证 是否安装成功
sudo docker -v

cat > /etc/docker/daemon.json <<EOF
{
    "insecure-registries": ["0.0.0.0/0"],
    "registry-mirrors": ["https://wbdhknhl.mirror.aliyuncs.com"]
}
EOF

root@mqq-virtual-machine:# sudo docker -v
Docker version 20.10.21, build 20.10.21-0ubuntu1~22.10.2

注意:利用apt -y install docker*安装的版本是docker20.10

你可能感兴趣的:(docker容器相关,linux,docker,eureka,容器)