centos

CentOS Stream 8容器化实践指南

小樊
36
2025-02-24 19:45:35
栏目: 智能运维
Centos服务器限时活动,0元免费领! 查看>>

CentOS Stream 8 是 Red Hat 企业级 Linux (RHEL) 的一个上游公共开发分支,旨在提供一种持续交付的发行版,定位于 Fedora Linux 和 RHEL 之间。以下是关于 CentOS Stream 8 容器化实践的一些基本步骤和指南:

安装 Docker

在 CentOS Stream 8 上安装 Docker 的步骤如下:

  1. 更新系统
sudo dnf update -y
  1. 安装依赖包
sudo dnf install -y dnf-plugins-core
  1. 添加 Docker 官方仓库
sudo dnf config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
  1. 安装 Docker
sudo dnf install docker-ce --nobest -y
  1. 启动 Docker 服务
sudo systemctl start docker
  1. 设置 Docker 开机自启动
sudo systemctl enable docker
  1. 验证 Docker 安装
docker --version

使用 Docker 容器化实践

docker run -itd --privileged --name centos-test -p 5022:22 centos:centos8 /usr/sbin/init
docker exec -it centos-test /bin/bash
yum update -y
yum install openssh-server vim passwd openssh-clients net-tools -y
systemctl start sshd
systemctl enable sshd
vim /etc/ssh/sshd_config
# 取消 Port、ListenAddress、PermitRootLogin、PubkeyAuthentication 的注释
passwd root
systemctl restart sshd
ssh root@localhost -p 5022
docker commit centos-test centos:ssh

注意事项

以上步骤和指南为在 CentOS Stream 8 上进行容器化实践提供了基础的操作流程。根据具体需求,可能还需要进行更多的配置和调整。

亿速云「云服务器」,即开即用、新一代英特尔至强铂金CPU、三副本存储NVMe SSD云盘,价格低至29元/月。点击查看>>

相关推荐:CentOS Stream 8虚拟化实践

0
看了该问题的人还看了