Deian/Ubuntu安装docker
-
安装所需要环境
sudo apt update sudo apt install ca-certificates curl gnupg lsb-release lsb-core apt-transport-https
-
添加 Docker 的官方 GPG 密钥
sudo mkdir -p /etc/apt/keyrings curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
-
使用以下命令设置存储库
echo \ "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/debian \ $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null # 修改公钥权限 sudo chmod a+r /etc/apt/keyrings/docker.gpg
-
安装 Docker 引擎
sudo apt update sudo apt-get install docker-ce docker-ce-cli containerd.io docker-compose
-
WSL需要使用以下命令启动docker
sudo service start docker
-
通过运行映像来验证 Docker 引擎是否已正确安装。hello-world
sudo docker run hello-world
-
出现类似于以下信息即为成功
Unable to find image 'hello-world:latest' locally latest: Pulling from library/hello-world 2db29710123e: Pull complete Digest: sha256:13e367d31ae85359f42d637adf6da428f76d75dc9afeb3 c21faea0d976f5c651 Status: Downloaded newer image for hello-world:latest 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.
评论
隐私政策
你无需删除空行,直接评论以获取最佳展示效果