Ubuntu无法自动获取IP

用Ubuntu不多, 近日一个服务器无法自动获取IP, 最后发现执行一下命令就可以了

dhclient -v ens18
为啥启动的时候不获取,也不知道,在 /etc/netplan/*.yml里面是有dhcpv4的.
apt install netplan.io
然后 netplan generate
netplan apply
后面再重启就会自动获取IP了

Linux安装最新版本的Docker

安装依赖工具

bash复制sudo apt update
sudo apt install -y ca-certificates curl gnupg lsb-release

步骤 3:添加 Docker 官方 GPG 密钥

bash复制sudo mkdir -p /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg

步骤 4:添加 Docker APT 源

根据你的系统版本选择对应的源(以下以 Ubuntu 为例):

bash复制echo \
  "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
  $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

如果是 Debian,将 ubuntu替换为 debian

bash复制echo \
  "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/debian \
  $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

步骤 5:安装 Docker 最新版

bash复制sudo apt update
sudo apt install -y docker-ce docker-ce-cli containerd.io docker-compose-plugin