永夜-Evernight

永夜降临之前,你都有改变的资格

docker安装centos

CentOS(Community Enterprise Operating System)是 Linux 发行版之一,它是来自于 Red Hat Enterprise Linux(RHEL) 依照开放源代码规定发布的源代码所编译而成。由于出自同样的源代码,因此有些要求高度稳定性的服务器以 CentOS 替代商业版的 Red Hat Enterprise Linux 使用。

1、查看可用的 CentOS 版本

访问 CentOS 镜像库地址:https://hub.docker.com/_/centos?tab=tags&page=1。

可以通过 Sort by 查看其他版本的 CentOS 。默认是最新版本 centos:latest 。

dockercentos1.png

你也可以在下拉列表中找到其他你想要的版本:
dockercentos2.png

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

$ docker pull centos:centos7

dockercentos3.png

3、查看本地镜像

使用以下命令来查看是否已安装了 centos7:

$ docker images

dockercentos4.png

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

$ docker run -d --name centos7 --privileged=true centos:centos7 /usr/sbin/init

dcokercentos6.png

5、安装成功

最后我们可以通过 docker ps 命令查看容器的运行信息:
dockercentos7.png

进入容器

docker exec -it centos7 /bin/bash

原文链接:https://www.runoob.com/docker/docker-install-centos.html


标题:docker安装centos
作者:luomuren
地址:http://luomuren.top/articles/2021/04/14/1618409296447.html