Ubuntu24.04部署docker
1、更新软件
apt update
2、安装curl
apt install apt-transport-https curl
3、导入阿里云GPG秘钥
curl -fsSL https://mirrors.aliyun.com/docker-ce/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
4、添加Docker阿里云仓库到Ubuntu 24.04的软件源列表
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://mirrors.aliyun.com/docker-ce/linux/ubuntu/ $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
更新
apt update
5、安装Docker
apt install docker-ce docker-ce-cli containerd.io docker-compose-plugin
确定安装成功
docker version
如果运行出现提示:
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
重启service服务
systemctl restart docker.service
6、安装Docker Compose
直接官方拉去:
curl -L https://github.com/docker/compose/releases/latest/download/docker-compose-Linux-x86_64 > /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
查看版本
docker-compose version