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/
相关推荐
freyazzr18 分钟前
C++八股 | Day2 | atom/函数指针/指针函数/struct、Class/静态局部变量、局部变量、全局变量/强制类型转换
c++
Gaoithe32 分钟前
ubuntu 端口复用
linux·运维·ubuntu
fpcc1 小时前
跟我学c++中级篇——理解类型推导和C++不同版本的支持
开发语言·c++
德先生&赛先生1 小时前
Linux编程:1、文件编程
linux
三三十二1 小时前
STM32实战:数字音频播放器开发指南
stm32·单片机·嵌入式硬件
程序猿小D2 小时前
第16节 Node.js 文件系统
linux·服务器·前端·node.js·编辑器·vim
终焉代码2 小时前
STL解析——list的使用
开发语言·c++
DevangLic2 小时前
【 *p取出内容 &a得到地址】
c++
鑫鑫向栄2 小时前
[蓝桥杯]修改数组
数据结构·c++·算法·蓝桥杯·动态规划
鑫鑫向栄2 小时前
[蓝桥杯]带分数
数据结构·c++·算法·职场和发展·蓝桥杯