当前位置: 首页 > article >正文

2025 ubuntu24.04系统安装docker

1.查看ubuntu版本(Ubuntu 24.04 LTS)

root@master:~# cat /etc/os-release 
PRETTY_NAME="Ubuntu 24.04 LTS"
NAME="Ubuntu"
VERSION_ID="24.04"
VERSION="24.04 LTS (Noble Numbat)"
VERSION_CODENAME=noble
ID=ubuntu
ID_LIKE=debian
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
UBUNTU_CODENAME=noble
LOGO=ubuntu-logo
root@master:~# 

2.安装必要的依赖包

sudo apt update
sudo apt upgrade -y
sudo apt install -y apt-transport-https ca-certificates curl software-properties-common

3.添加Docker官方GPG密钥

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg

4. 添加Docker仓库

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

5. 安装Docker

sudo apt update
sudo apt install -y docker-ce docker-ce-cli containerd.io
sudo systemctl start docker
sudo systemctl enable docker
sudo systemctl status docker
sudo docker --version

6.添加可用的apt源

cat > /etc/docker/daemon.json << EOF
{
  "registry-mirrors": ["https://docker.registry.cyou","https://docker-cf.registry.cyou","https://dockercf.jsdelivr.fyi","https://docker.jsdelivr.fyi","https://dockertest.jsdelivr.fyi","https://mirror.aliyuncs.com","https://dockerproxy.com","https://mirror.baidubce.com","https://docker.m.daocloud.io","https://docker.nju.edu.cn","https://docker.mirrors.sjtug.sjtu.edu.cn","https://docker.mirrors.ustc.edu.cn","https://mirror.iscas.ac.cn","https://docker.rainbond.cc"],
  "insecure-registries": ["0.0.0.0/0"],
  "exec-opts": ["native.cgroupdriver=systemd"],
  "log-driver": "json-file",
  "log-opts": {
    "max-size": "100m"
  },
  "storage-driver": "overlay2"
}
EOF
sudo systemctl restart docker  #重启docker

7. 测试Docker

docker run hello-world

如果一切正常,你会看到一条欢迎消息,表示Docker已成功安装并运行。

至此,Docker已在Ubuntu 24.04上成功安装。


http://www.kler.cn/a/572874.html

相关文章:

  • 宠物医疗对接DeepSeek详细方案
  • C++中的 互斥量
  • DeepSeek开源周:五大创新项目详解
  • 自定义wordpress三级导航菜单代码
  • FPGA——4位全加器及3-8译码器的实现
  • 2025东方财富笔试考什么?cata能力测评攻略|答题技巧真题分享
  • STM32 两个单片机之间的通信
  • Predix:工业互联网浪潮中的领航者与破局者(工业4.0的长子)
  • SpringTask 引起的错误
  • Linux--基础命令3
  • <Rust><iced>基于rust使用iced构建GUI实例:图片浏览器
  • 安全检查之springboot 配置加密
  • 十大经典排序算法简介
  • nginx 配置403页面(已亲测)
  • leetcode 1328. 破坏回文串 中等
  • Minix OS的配置 SSH C程序编译
  • 网络安全中分区分域
  • 001.words and phrases
  • 【Java 基础(人话版)】Java 虚拟机(JVM)
  • 创建自定义的Spingboot启动器