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/
相关推荐
C_心欲无痕3 小时前
Dockerfile:构建 Docker 镜像
运维·docker·容器
zz_nj3 小时前
工作的环境
linux·运维·服务器
C_心欲无痕4 小时前
nginx - 实现域名跳转的几种方式
运维·前端·nginx
suijishengchengde5 小时前
****LINUX时间同步配置*****
linux·运维
幻云20105 小时前
AI自动化编排:从入门到精通(基于Dify构建AI智能系统)
运维·人工智能·自动化
qiuqyue5 小时前
基于虹软Linux Pro SDK的多路RTSP流并发接入、解码与帧级处理实践
linux·运维·网络
C_心欲无痕5 小时前
Docker 本地部署 CSR 前端项目完整指南
前端·docker·容器
爱跑马的程序员6 小时前
Linux 如何查看文件夹的大小(du、df、ls、find)
linux·运维·ubuntu
飞翔沫沫情8 小时前
MinIO 新版本 Docker 部署指南:告别 Web 控制台,拥抱 CLI 管理
docker·容器·docker-compose·对象存储·minio
代码AI弗森8 小时前
n8n 专题:从“自动化脚本”到“可视化工作流引擎”(自建、节点、Webhook、生产部署)
运维·自动化