docker————docker的安装

目录

docker的安装

1、安装yum-utils工具

2、安装yum仓库

3、安装docker引擎

4、设置开机启动,并立即启动

5、测试


docker的安装

docker的官网Docker Docs

我才用的linux版本是rocky,使用的是最小安装

1、安装yum-utils工具

bash 复制代码
[root@bogon yum.repos.d]# yum install -y yum-utils

2、安装yum仓库

bash 复制代码
[root@bogon ~]# sudo dnf config-manager --add-repo https://download.docker.com/linux/rhel/docker-ce.repo
Adding repo from: https://download.docker.com/linux/rhel/docker-ce.repo
[root@bogon ~]# yum repolist
repo id                                           repo name
appstream                                         Rocky Linux 9 - AppStream
baseos                                            Rocky Linux 9 - BaseOS
docker-ce-stable                                  Docker CE Stable - x86_64
extras                                            Rocky Linux 9 - Extras

3、安装docker引擎

bash 复制代码
[root@bogon ~]# yum install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

4、设置开机启动,并立即启动

bash 复制代码
[root@bogon ~]# systemctl enable docker --now
Created symlink /etc/systemd/system/multi-user.target.wants/docker.service → /usr/lib/systemd/system/docker.service.

5、测试

bash 复制代码
[root@bogon ~]# docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
c1ec31eb5944: Pull complete 
Digest: sha256:53641cd209a4fecfc68e21a99871ce8c6920b2e7502df0a20671c6fccc73a7c6
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.

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/
相关推荐
梦白.2 小时前
Python的容器类型
运维·python
AlfredZhao3 小时前
用Docker安全驯服OpenClaw,并打通社交软件
docker·飞书·openclaw
tuotali20264 小时前
天然气压缩机技术2026,高可靠性长周期运行与智能运维融合路径
运维·python
姚不倒4 小时前
三节点 TiDB 集群部署与负载均衡搭建实战
运维·数据库·分布式·负载均衡·tidb
gpio_014 小时前
自建gitlab服务器并用sakurafrp穿透
运维·服务器·gitlab
k7Cx7e4 小时前
Debian执行ssh root@localhost 提示认证失败
运维·debian·ssh
闻道且行之4 小时前
Nginx 安装、做成服务及 HTTPS 配置全流程
linux·运维·nginx·https
人工智能训练4 小时前
Qwen3.5 开源全解析:从 0.8B 到 397B,代际升级 + 全场景选型指南
linux·运维·服务器·人工智能·开源·ai编程
蜕变的小白4 小时前
Linux系统编程-->UDP编程:C/S模型实战详解
linux·运维·网络协议·udp
FIT2CLOUD飞致云4 小时前
里程碑丨JumpServer开源堡垒机GitHub Star数突破30,000个!
运维·开源·堡垒机