Ubuntu快速安装docker

随着Ubuntu的大面积推广,以及CentOS的社区停止维护,越来越多的企业需要把业务系统迁移到Ubuntu上。容器化也是如此,下面教你快速部署docekr
step1:安装依赖
1.更新软件包索引并安装软件包以允许使用 基于 HTTPS 的存储库:
$ sudo apt-get update

sudo apt-get install ca-certificates curl gnupg

sudo apt-get -y install apt-transport-https ca-certificates curl gnupg software-properties-common
step 2: 安装GPG证书
curl -fsSL https://mirrors.aliyun.com/docker-ce/linux/ubuntu/gpg | sudo apt-key add -
Step 3: 写入软件源信息
sudo add-apt-repository “deb [arch=amd64] https://mirrors.aliyun.com/docker-ce/linux/ubuntu ( l s b r e l e a s e − c s ) s t a b l e " 使用以下命令设置存储库: e c h o " d e b [ a r c h = " (lsb_release -cs) stable" 使用以下命令设置存储库: echo "deb [arch=" (lsbreleasecs)stable"使用以下命令设置存储库:echo"deb[arch="(dpkg --print-architecture)” signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu
KaTeX parse error: Expected 'EOF', got '&' at position 20: …etc/os-release &̲& echo "VERSION_CODENAME”)" stable" |
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
安装 Docker 引擎
更新包索引:apt
sudo apt-get update
安装 Docker Engine、containerd 和 Docker Compose
最近版本
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
或者安装特定版本
List the available versions:
apt-cache madison docker-ce | awk '{ print KaTeX parse error: Expected 'EOF', got '}' at position 3: 3 }̲' 5:24.0.0-1~ub…VERSION_STRING docker-ce-cli=$VERSION_STRING containerd.io docker-buildx-plugin docker-compose-plugin

通过运行映像验证 Docker 引擎安装是否成功。hello-world
sudo docker run hello-world
将docker设置为开机自启
systemctl enable docker
操作 Docker 必须要有 root 权限,直接使用 root 用户不够安全,加入 Docker 用户组是一个比较好的选择。
如果你没有使用 root 账号,则需要将当前用户加入 Docker 的用户组:
sudo usermod -aG docker ${USER} # 当前用户加入docker组
docker version # 输出Docker客户端和服务器各自的版本信息
sudo systemctl enable docker # 配置Docker为开机自启动
sudo systemctl daemon-reload # 重新加载服务的配置文件
sudo systemctl restart docker # 重启Docker

相关推荐

  1. Ubuntu快速安装docker

    2024-03-16 22:06:06       46 阅读
  2. prometheus-docker 快速安装

    2024-03-16 22:06:06       64 阅读
  3. ubuntu安装docker

    2024-03-16 22:06:06       63 阅读
  4. ubuntu怎么安装docker

    2024-03-16 22:06:06       58 阅读

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-03-16 22:06:06       98 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-03-16 22:06:06       106 阅读
  3. 在Django里面运行非项目文件

    2024-03-16 22:06:06       87 阅读
  4. Python语言-面向对象

    2024-03-16 22:06:06       96 阅读

热门阅读

  1. 【Unity】详细介绍

    2024-03-16 22:06:06       43 阅读
  2. Linux-网络基础

    2024-03-16 22:06:06       43 阅读
  3. Redis 慢查询是什么?如何配置使用

    2024-03-16 22:06:06       41 阅读
  4. 通过服务器配置cros来解决跨域问题

    2024-03-16 22:06:06       43 阅读
  5. ARTS Week 21

    2024-03-16 22:06:06       43 阅读
  6. 【记录】Git A项目作为产品,B项目继承A项目

    2024-03-16 22:06:06       39 阅读
  7. 如何将csv文件转换为markdown表格

    2024-03-16 22:06:06       40 阅读
  8. 什么是去中心化,如何去中心化

    2024-03-16 22:06:06       36 阅读
  9. 安装elasticsearch、kibana

    2024-03-16 22:06:06       45 阅读