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 小时前
Kubernetes——k8s v1.24离线部署(Containerd + Calico)
云原生·容器·kubernetes
Lonely 净土3 小时前
Rocky Linux 安装教程
linux·运维·服务器
光影少年3 小时前
RN的Fabric 渲染流程
运维·前端·javascript·react native·react.js·fabric
A 糖醋排骨4 小时前
grafana loki alloy轻量级日志采集
运维·grafana·loki
营养充电站4 小时前
KMP全栈开发:从Android到AI Agent的技术演进与实践
人工智能·算法·docker·jupyter
崔亮的博客5 小时前
K8S GPU 调度——Operator 自动管理GPU
云原生·容器·kubernetes
小义_5 小时前
K8s 全网高频常用命令大全
docker·容器·kubernetes
林间码客6 小时前
从DevOps到DevSecOps:构建现代软件交付的基石与护城河
大数据·运维·devsecops·devops
Lust Dusk7 小时前
记一次Linux应急响应题目解析
linux·运维·服务器·网络·安全·网络安全
轻揉小乔 真新人9 小时前
使用memc-nginx和srcache-nginx模块构建高效透明的缓存机制
运维·nginx·缓存