Docker 安装 CentOS教程

2023-07-0910:45:06服务器及运维Comments1,095 views字数 542阅读模式

CentOS(Community Enterprise Operating System)是 Linux 发行版之一,它是来自于 Red Hat Enterprise Linux(RHEL) 依照开放源代码指定发布的源代码所编译而成。由于出自同样的源代码,因此有些要求高度稳定性的服务器以 CentOS 代替商业版的 Red Hat Enterprise Linux 使用。文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/50807.html

1、查看可用的 CentOS 版本

访问 CentOS 镜像库地址:https://hub.docker.com/_/centos?tab=tags&page=1文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/50807.html

可以通过 Sort by 查看其他版本的 CentOS 。默认是最新版本 centos:latest 。文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/50807.html

Docker 安装 CentOS教程文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/50807.html

你也可以在下拉列表中找到其他你想要的版本:文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/50807.html

Docker 安装 CentOS教程文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/50807.html

2、拉取指定版本的 CentOS 镜像,这里我们安装指定版本为例(centos7):

$ docker pull centos:centos7

Docker 安装 CentOS教程文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/50807.html

3、查看本地镜像

使用以下命令来查看是否已安装了 centos7:文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/50807.html

$ docker images

Docker 安装 CentOS教程文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/50807.html

4、运行容器,并且可以通过 exec 命令进入 CentOS 容器。

$ docker run -itd --name centos-test centos:centos7

Docker 安装 CentOS教程文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/50807.html

Docker 安装 CentOS教程文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/50807.html

5、安装成功

最后我们可以通过 docker ps 命令查看容器的运行信息:文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/50807.html

Docker 安装 CentOS教程文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/50807.html

  • 本站内容整理自互联网,仅提供信息存储空间服务,以方便学习之用。如对文章、图片、字体等版权有疑问,请在下方留言,管理员看到后,将第一时间进行处理。
  • 转载请务必保留本文链接:https://www.cainiaoxueyuan.com/yunwei/50807.html

Comment

匿名网友 填写信息

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定