Ubuntu 22.04 安装 Docker Engine

Install Docker Engine on Ubuntu | Docker Docs

比较方便的安装方式为通过 Apt Repo 来安装,需要三大步:

1. 预备仓库信息:

逐行执行一下命令

# 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
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" | \
  sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update

2. 安装Docker Engine

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

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

3. 下载 docker image

sudo docker pull ubuntu
sudo docker pull socalucr/gpgpu-sim

3. 测试

sudo docker run --name=ubuntu_hello2 -it  ubuntu:latest /bin/bash

exit   退出

你可能感兴趣的:(ubuntu,docker,linux)