avatar

請勿斷片

演好各自的剧本

  • 首页
  • 导航
  • linux
  • 关于
Home Ubuntu_22.04.3_LTS_安装docker_
文章

Ubuntu_22.04.3_LTS_安装docker_

Posted 2023-11-30 Updated 2024-11- 19
By Administrator
8~11 min read

Ubuntu 22.04.3 LTS 安装docker

使用 apt 存储库安装

1、设置 Docker 的存储库。apt

# Add Docker's official GPG key:
#注意逐行运行
sudo apt-get update

sudo apt-get install ca-certificates curl gnupg

sudo install -m 0755 -d /etc/apt/keyrings

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
# 上面的echo是一整段运行 
sudo chmod a+r /etc/apt/keyrings/docker.gpg

# Add the repository to Apt sources:
echo \
  "deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
  "$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | \
# 上面的echo是一整段运行 
  sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
  
sudo apt-get update

2、安装 Docker 包

若要安装最新版本,请运行:

$ sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

3、通过运行映像来验证 Docker 引擎安装是否成功。hello-world

sudo docker run hello-world
  1. 此命令下载测试映像并在容器中运行它。当 容器运行,它打印确认消息并退出。

4、现在,您已成功安装并启动 Docker Engine。

Configure Docker to start on boot with systemd

将 Docker 配置为使用 systemd 在启动时启动

Many modern Linux distributions use systemd to manage which services start when the system boots. On Debian and Ubuntu, the Docker service starts on boot by default. To automatically start Docker and containerd on boot for other Linux distributions using systemd, run the following commands:

许多现代 Linux 发行版使用 systemd 来 管理系统启动时启动的服务。在 Debian 和 Ubuntu 上, 默认情况下,Docker 服务在启动时启动。要自动启动 Docker 和 containerd 在使用 systemd 的其他 Linux 发行版的启动时,运行 以下命令:

$ sudo systemctl enable docker.service
$ sudo systemctl enable containerd.service

To stop this behavior, use instead.disable

若要停止此行为,请改用。disable

$ sudo systemctl disable docker.service
$ sudo systemctl disable containerd.service

安装 Compose 插件

使用存储库安装

  1. 设置存储库。在以下位置查找特定于发行版的说明:

    Ubuntu的 |CentOS操作系统 |Debian 操作系统 |

  2. 更新包索引,并安装最新版本的 Docker Compose:

    • 对于 Ubuntu 和 Debian,请运行:

      $ sudo apt-get update
      $ sudo apt-get install docker-compose-plugin
      
    • 对于基于 RPM 的发行版,请运行:

      $ sudo yum update
      $ sudo yum install docker-compose-plugin
      
  3. 通过检查版本来验证 Docker Compose 是否已正确安装。

    $ docker compose version
    

    预期输出:

    Docker Compose version vN.N.N
    

    占位符文本代表最新版本的位置在哪里。vN.N.N

🚀Linux
Ubuntu linux 信息互联
License:  CC BY 4.0
Share

Further Reading

Jan 18, 2024

Windows___定时备份___自动备份文件夹

bat方式适合设置开机启动 VBScript方式适合

Nov 30, 2023

Ubuntu_22.04.3_LTS_安装docker_

Ubuntu 22.04.3 LTS 安装docker 使用 apt 存储库安装 1、设置 Docker 的存储库。apt # Add Docker's official GP

Nov 20, 2023

ubuntu22开启root远程登录

ubuntu18.04开启root远程登录 首先安装 OpenSSH Server Installation Installation of the OpenSSH client and server applications is simple. To install the OpenSSH cl

OLDER

ubuntu22开启root远程登录

NEWER

Windows___定时备份___自动备份文件夹

Recently Updated

  • Windows___定时备份___自动备份文件夹
  • Ubuntu_22.04.3_LTS_安装docker_
  • ubuntu22开启root远程登录
  • Ubuntu22.04_笔记
  • 网站分享-配色网站

Trending Tags

Halo linux Centos 备份 windows Ubuntu 信息互联 姿势

Contents

©2025 請勿斷片. Some rights reserved.

Using the Halo theme Chirpy