新增Docker ssh管理

This commit is contained in:
2026-01-05 00:26:30 +08:00
parent a0a57e2fb5
commit 46124ba752
2 changed files with 66 additions and 4 deletions

View File

@@ -2,9 +2,37 @@
> 本文作者:丁辉
# Centos 镜像构建
# Centos
```bash
./build.sh
```
- Centos 基础镜像构建
```bash
./build.sh
```
- Centos 配置策略允许外部通过 SSH 登录
1. 构建镜像
```bash
docker build --build-arg ROOT_PASSWORD=password -t centos-ssh:7 -f Dockerfile-ssh .
```
**参数解释**
`ROOT_PASSWORD`:配置登录 Centos 默认 ROOT 密码
2. 启动镜像并登录
```bash
docker run --name centos -p 2222:22 -d centos-ssh:7
```
3. 登录
```bash
ssh -p 2222 root@IP
```