当前位置: 首页 > news >正文

[1-docker-01]centos环境安装docker

官方参考文档

可以在官方docker桌面版本指导文档里找到适合自己的电脑平台进行参考,或者你是老司机的话直接自己上车。

如果不需要桌面版,也可以在官方docker engine版本指导文档里找到适合自己的平台进行参考,同样,老司机可以自己上车。

安装docker

我装了一台全新的centos,因为安装的mini版本,所以一些工具要自己安装下,由于虚拟机提供的终端并不好用,所以先在虚拟机里安装下net-tools,查看下ip,以便下一步ssh远程连接。

# 更新yum源
yum update -y# 安装net-tools (ifconfig) 
yum install net-tools -y

然后使用ssh登陆:
在这里插入图片描述
先来看一下系统架构:

# 查看系统架构
[root@king ~]# uname -a
Linux king 3.10.0-1160.el7.x86_64 #1 SMP Mon Oct 19 16:18:59 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

安装一下日常工具和kvm相关依赖:

yum update -y && \
yum install -y vim less wget net-tools iputils-ping curl git && \
yum install -y libvirt libvirt-client virt-install qemu-kvm genisoimage qemu-guest-agent libguestfs-tools

以为是安装的centos mini,所以不存在旧版本docker,如果有的话需要先卸载:

yum erase docker \docker-client \docker-client-latest \docker-common \docker-latest \docker-latest-logrotate \docker-logrotate \docker-selinux \docker-engine-selinux \docker-engine \docker-ce`

运行以下命令,下载docker-ce的yum源:

sudo wget -O /etc/yum.repos.d/docker-ce.repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo

运行以下命令,安装Docker:

sudo yum -y install docker-ce

启动 Docker 并设置开机自启:

systemctl start docker
systemctl enable docker

验证安装:

docker version

验证安装结果:

[root@king ~]# docker version
Client: Docker Engine - CommunityVersion:           25.0.3API version:       1.44Go version:        go1.21.6Git commit:        4debf41Built:             Tue Feb  6 21:17:10 2024OS/Arch:           linux/amd64Context:           defaultServer: Docker Engine - CommunityEngine:Version:          25.0.3API version:      1.44 (minimum version 1.24)Go version:       go1.21.6Git commit:       f417435Built:            Tue Feb  6 21:16:08 2024OS/Arch:          linux/amd64Experimental:     falsecontainerd:Version:          1.6.28GitCommit:        ae07eda36dd25f8a1b98dfbf587313b99c0190bbrunc:Version:          1.1.12GitCommit:        v1.1.12-0-g51d5e94docker-init:Version:          0.19.0GitCommit:        de40ad0

验证运行:

docker run hello-world

验证运行结果:

Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
c1ec31eb5944: Pull complete 
Digest: sha256:4bd78111b6914a99dbc560e6a20eab57ff6655aea4a80c50b0c5491968cbc2e6
Status: Downloaded newer image for hello-world:latestHello 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 theexecutable that produces the output you are currently reading.4. The Docker daemon streamed that output to the Docker client, which sent itto your terminal.To try something more ambitious, you can run an Ubuntu container with:$ docker run -it ubuntu bashShare 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/
http://www.lryc.cn/news/298631.html

相关文章:

  • 深度学习基础之《深度学习介绍》
  • 4核8g服务器能支持多少人访问?2024新版测评
  • Linux中pipe管道操作
  • 中年中产程序员从西安出发到海南三亚低成本吃喝万里行:西安-南宁-湛江-雷州-徐闻-博鳌-陵水-三亚-重庆-西安(2.游玩过程)
  • day38 面向对象编程、构造函数等(纯概念)
  • nginx用域名http://xx.com/aaa/代理一个网页http://ff.com但是请求资源时发生404
  • NLP_词的向量表示Word2Vec 和 Embedding
  • python:xml.etree 生成思维导图 Freemind文件
  • Solidworks:从2D走向3D
  • 【开源】JAVA+Vue.js实现高校学院网站
  • 题解19-24
  • 基于图像掩膜和深度学习的花生豆分拣(附源码)
  • 【网络】:序列化和反序列化
  • AJ-Report 【开源的一个BI平台】
  • Matplotlib核心:掌握Figure与Axes
  • 问题:A注册会计师必须在期中实施实质性程序的情形是()。 #学习方法#其他
  • C#系列-C#EF框架返回单行记录(24)
  • 【PyTorch】张量(Tensor)的生成
  • 【5G NR】【一文读懂系列】移动通讯中使用的信道编解码技术-Viterbi译码原理
  • 矩阵在计算机图像处理中的应用
  • Java实现教学资源共享平台 JAVA+Vue+SpringBoot+MySQL
  • Spring Boot(六十五):使用 ant.jar 执行 SQL 脚本文件
  • 161基于matlab的快速谱峭度方法
  • CTFshow-WEB入门-信息搜集
  • django密码管理器(创建项目)
  • Centos7之Oracle12c安装与远程连接配置
  • CVE-2022-25578 漏洞复现
  • Ubuntu22.04安装黑屏(进入U盘安装引导时 和 安装完成后)
  • 一、DataX简介
  • 直播app开发,技术驱动的实时互动新纪元