ubuntu20.04/22.04/24.04 docker 容器安装方法

ubuntu20.04/22.04/24.04 docker 容器安装方法:

1 Set up Docker's apt repository.

c 复制代码
# Add Docker's official GPG key:
sudo apt-get update
sudo apt-get install ca-certificates curl
sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc

# Add the repository to Apt sources:
echo \
  "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \
  $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
  sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

sudo apt-get update

2 To install the latest version, run:

c 复制代码
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

3 Verify that the Docker Engine installation is successful by running the hello-world image.

c 复制代码
sudo docker run hello-world

显示如下表示安装成功:

c 复制代码
Hello from Docker!
This message shows that your installation appears to be working correctly.

To generate this message, Docker took the following steps:
 1. The Docker client contacted the Docker daemon.
 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
    (amd64)
 3. The Docker daemon created a new container from that image which runs the
    executable that produces the output you are currently reading.
 4. The Docker daemon streamed that output to the Docker client, which sent it
    to your terminal.

To try something more ambitious, you can run an Ubuntu container with:
 $ docker run -it ubuntu bash

Share images, automate workflows, and more with a free Docker ID:
 https://hub.docker.com/

For more examples and ideas, visit:
 https://docs.docker.com/get-started/
相关推荐
纪念 2295 分钟前
C++ 算法模板与错题 (前缀和)
开发语言·c++·算法
红龙创客24 分钟前
轻AI越影视觉开发板GUI教程:从开箱上手到修改显示界面
嵌入式硬件·嵌入式·海思
听情歌落俗35 分钟前
嵌入式学习2-STM32HAL库
单片机·嵌入式硬件
Brilliantwxx1 小时前
【STM32 外设篇】 LCD 显示(1):从显示屏分类到 ILI9341 与 GRAM
stm32·单片机·嵌入式硬件
Navigator_Z1 小时前
LeetCode //C - 1332. Remove Palindromic Subsequences
c语言·算法·leetcode
Code_Solitude1 小时前
c语言:期末复习(7)
c语言·开发语言·算法
潇湘散客1 小时前
PlantAis插件更新:RVM负实体开关;VUE文件读取与导出等
c++·qt·opengl
金榜题名萱1 小时前
蓝桥杯 - 旗帜
c语言·数据结构·c++·算法·蓝桥杯
俊俊几年的2 小时前
RK3588 硬件架构详解:CPU、GPU、NPU 与 RKNN 软件栈
linux·c++·python·yolo·numpy·rockchip
jianqiang.xue2 小时前
GCC 15 还是 ST-ARM-Clang:STM32 的 VS Code 工具链怎么定
c语言·arm开发·stm32·嵌入式硬件·嵌入式·ai编程·代码审查