Docker容器的安装

Docker容器的安装

Linux平台

先决条件

1、命令行查看linux服务器系统
admin@i-0dcdd3a78b8732214:~/huazai_netdisk$ cat /etc/issue
Debian GNU/Linux 11 \n \l

可以看到博主系统是Debian去官网

2、官网打开找到对应的版本,在这里插注意操作系统要求的版本

在这里插注意操作系统要求的版本*入图片描述

3、如果之前安装过docker,进行安装前要卸载docker组件

在这里插入图片描述

运行以下命令卸载所有冲突的包:(我没有安装过docker 就选择跳过)

for pkg in docker.io docker-doc docker-compose podman-docker containerd runc; do sudo apt-get remove $pkg; done

安装方法

1、使用 apt 存储库安装在新主机上首次安装 Docker Engine 之前,需要设置 Dockerapt存储库。之后,
您可以从存储库安装和更新 Docker。
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/debian/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
sudo chmod a+r /etc/apt/keyrings/docker.gpg

sudo apt-get update 最后再执行一次update..博主踩过坑

2、安装docker依赖包 要安装最新版本,请运行:
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
3、通过运行镜像验证安装是否成功hello-world :sudo docker run hello-world

admin@i-0dcdd3a78b8732214:~/huazai_netdisk$ sudo docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
70f5ac315c5a: Pull complete 
Digest: sha256:c79d06dfdfd3d3eb04cafd0dc2bacab0992ebc243e083cabe208bac4dd7759e0
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.
    (arm64v8)
 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/

admin@i-0dcdd3a78b8732214:~/huazai_netdisk$ 

看到hello form docker说明安装完成,祝大家安装顺利;

  • 8
    点赞
  • 11
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值