mirror of
https://github.com/yeasy/docker_practice.git
synced 2026-08-10 08:27:25 +00:00
chore: lint cleanup and version corrections
- Accept benign linter changes (version notes, explicit tags, formatting) - Fix incorrect version downgrades introduced by linter: - golang:1.22→1.26 (restored) - rust:1.82→1.95 (restored) - 23 files updated
This commit is contained in:
@@ -2,6 +2,12 @@
|
||||
|
||||
从 Docker 镜像仓库获取镜像可谓是 Docker 运作的第一步。本节将介绍如何使用 `docker pull` 命令下载镜像,以及如何理解下载过程。
|
||||
|
||||
> **版本号最佳实践**
|
||||
>
|
||||
> - **永远指定版本号**:避免使用 `latest` 标签,应指定具体的版本(如 `ubuntu:24.04`、`nginx:1.27`),以确保镜像内容稳定一致。
|
||||
> - **在生产环境使用摘要**:优先使用镜像摘要(SHA256)而非标签,如 `nginx@sha256:abc123...`,因为摘要不可变。
|
||||
> - **定期评估依赖**:即使指定了版本号,仍应定期检查依赖的基础镜像是否有安全更新。
|
||||
|
||||
### 4.1.1 docker pull 命令
|
||||
|
||||
从镜像仓库获取镜像的命令是 `docker pull`:
|
||||
@@ -135,6 +141,9 @@ PRETTY_NAME="Ubuntu 24.04 LTS"
|
||||
...
|
||||
root@e7009c6ce357:/# exit
|
||||
```
|
||||
|
||||
> 本例使用 `ubuntu:24.04` 这样的具体版本标签是最佳实践。若无特殊需求,避免使用 `docker pull ubuntu` 或 `ubuntu:latest`,因为镜像内容可能在某个时刻发生变化。
|
||||
|
||||
**参数说明**:
|
||||
|
||||
| 参数 | 说明 |
|
||||
|
||||
Reference in New Issue
Block a user