mirror of
https://github.com/yeasy/docker_practice.git
synced 2026-03-10 20:04:36 +00:00
Use a better structure
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
# 操作系统
|
||||
## 操作系统
|
||||
|
||||
目前常用的 Linux 发行版主要包括 `Debian/Ubuntu` 系列和 `CentOS/Fedora` 系列。
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Alpine
|
||||
## Alpine
|
||||
|
||||
## 简介
|
||||
### 简介
|
||||
|
||||

|
||||
|
||||
@@ -22,7 +22,7 @@ ubuntu latest b39b81afc8ca 188.3 MB
|
||||
centos latest 8efe422e6104 210 MB
|
||||
```
|
||||
|
||||
## 获取并使用官方镜像
|
||||
### 获取并使用官方镜像
|
||||
|
||||
由于镜像很小,下载时间往往很短,读者可以直接使用 `docker run` 指令直接运行一个 `Alpine` 容器,并指定运行的 Linux 指令,例如:
|
||||
|
||||
@@ -31,7 +31,7 @@ $ docker run alpine echo '123'
|
||||
123
|
||||
```
|
||||
|
||||
## 迁移至 `Alpine` 基础镜像
|
||||
### 迁移至 `Alpine` 基础镜像
|
||||
|
||||
目前,大部分 Docker 官方镜像都已经支持 `Alpine` 作为基础镜像,可以很容易进行迁移。
|
||||
|
||||
@@ -61,7 +61,7 @@ RUN sed -i "s/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g" /etc/apk/repositories
|
||||
&& apk add --no-cache <package>
|
||||
```
|
||||
|
||||
## 相关资源
|
||||
### 相关资源
|
||||
|
||||
* `Alpine` 官网:https://www.alpinelinux.org/
|
||||
* `Alpine` 官方仓库:https://github.com/alpinelinux
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Busybox
|
||||
## Busybox
|
||||
|
||||
## 简介
|
||||
### 简介
|
||||
|
||||

|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
`BusyBox` 可运行于多款 `POSIX` 环境的操作系统中,如 `Linux`(包括 `Android`)、`Hurd`、`FreeBSD` 等。
|
||||
|
||||
## 获取官方镜像
|
||||
### 获取官方镜像
|
||||
|
||||
可以使用 `docker pull` 指令下载 `busybox:latest` 镜像:
|
||||
|
||||
@@ -29,7 +29,7 @@ REPOSITORY TAG IMAGE ID CREATED
|
||||
busybox latest e72ac664f4f0 6 weeks ago 2.433 MB
|
||||
```
|
||||
|
||||
## 运行 busybox
|
||||
### 运行 busybox
|
||||
|
||||
启动一个 `busybox` 容器,并在容器中执行 `grep` 命令。
|
||||
|
||||
@@ -107,7 +107,7 @@ tmpfs on /sys/firmware type tmpfs (ro,relatime)
|
||||
|
||||
`busybox` 镜像虽然小巧,但包括了大量常见的 `Linux` 命令,读者可以用它快速熟悉 `Linux` 命令。
|
||||
|
||||
## 相关资源
|
||||
### 相关资源
|
||||
|
||||
* `Busybox` 官网:https://busybox.net/
|
||||
* `Busybox` 官方仓库:https://git.busybox.net/busybox/
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# CentOS Fedora
|
||||
## CentOS Fedora
|
||||
|
||||
## CentOS 系统简介
|
||||
### CentOS 系统简介
|
||||
|
||||
`CentOS` 和 `Fedora` 都是基于 `Redhat` 的常见 Linux 分支。`CentOS` 是目前企业级服务器的常用操作系统;`Fedora` 则主要面向个人桌面用户。
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
CentOS(Community Enterprise Operating System,中文意思是:社区企业操作系统),它是基于 `Red Hat Enterprise Linux` 源代码编译而成。由于 `CentOS` 与 `Redhat Linux` 源于相同的代码基础,所以很多成本敏感且需要高稳定性的公司就使用 `CentOS` 来替代商业版 `Red Hat Enterprise Linux`。`CentOS` 自身不包含闭源软件。
|
||||
|
||||
### 使用 CentOS 官方镜像
|
||||
#### 使用 CentOS 官方镜像
|
||||
|
||||
**注意:CentOS 8 已于 2021 年 12 月 31 日停止维护(EOL)。对于新部署,推荐使用 CentOS Stream,或 Rocky Linux、AlmaLinux 等替代发行版。**
|
||||
|
||||
@@ -25,13 +25,13 @@ Status: Downloaded newer image for centos:latest
|
||||
CentOS Linux release 7.9.2009 (Core)
|
||||
```
|
||||
|
||||
## Fedora 系统简介
|
||||
### Fedora 系统简介
|
||||
|
||||

|
||||
|
||||
`Fedora` 由 `Fedora Project` 社区开发,红帽公司赞助的 `Linux` 发行版。它的目标是创建一套新颖、多功能并且自由和开源的操作系统。`Fedora` 的功能对于用户而言,它是一套功能完备的,可以更新的免费操作系统,而对赞助商 `Red Hat` 而言,它是许多新技术的测试平台。被认为可用的技术最终会加入到 `Red Hat Enterprise Linux` 中。
|
||||
|
||||
### 使用 Fedora 官方镜像
|
||||
#### 使用 Fedora 官方镜像
|
||||
|
||||
使用 `docker run` 命令直接运行 `Fedora` 官方镜像,并登录 `bash`。
|
||||
|
||||
@@ -45,7 +45,7 @@ Status: Downloaded newer image for fedora:latest
|
||||
Fedora release 39 (Thirty Nine)
|
||||
|
||||
|
||||
## 相关资源
|
||||
### 相关资源
|
||||
|
||||
* `Fedora` 官网:https://getfedora.org/
|
||||
* `Fedora` 官方仓库:https://github.com/fedora-infra
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
# Debian Ubuntu
|
||||
## Debian Ubuntu
|
||||
|
||||
`Debian` 和 `Ubuntu` 都是目前较为流行的 **Debian 系** 的服务器操作系统,十分适合研发场景。`Docker Hub` 上提供了官方镜像,国内各大容器云服务也基本都提供了相应的支持。
|
||||
|
||||
## Debian 系统简介
|
||||
### Debian 系统简介
|
||||
|
||||

|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
|
||||
众多的 `Linux` 发行版,例如 `Ubuntu`、`Knoppix` 和 `Linspire` 及 `Xandros` 等,都基于 `Debian GNU/Linux`。
|
||||
|
||||
### 使用 Debian 官方镜像
|
||||
#### 使用 Debian 官方镜像
|
||||
|
||||
官方提供了大家熟知的 `debian` 镜像以及面向科研领域的 `neurodebian` 镜像。可以使用 `docker run` 直接运行 `Debian` 镜像。
|
||||
|
||||
@@ -24,13 +24,13 @@ Debian GNU/Linux 8
|
||||
|
||||
`Debian` 镜像很适合作为基础镜像,构建自定义镜像。
|
||||
|
||||
## Ubuntu 系统简介
|
||||
### Ubuntu 系统简介
|
||||
|
||||

|
||||
|
||||
`Ubuntu` 是一个以桌面应用为主的 `GNU/Linux` 操作系统,其名称来自非洲南部祖鲁语或豪萨语的“ubuntu”一词(官方译名“友帮拓”,另有“吾帮托”、“乌班图”、“有奔头”或“乌斑兔”等译名)。`Ubuntu` 意思是“人性”以及“我的存在是因为大家的存在”,是非洲传统的一种价值观,类似华人社会的“仁爱”思想。 `Ubuntu` 基于 `Debian` 发行版和 `GNOME/Unity` 桌面环境,与 `Debian` 的不同在于它每 6 个月会发布一个新版本,每 2 年推出一个长期支持 **(Long Term Support,LTS)** 版本,一般支持 3 年时间。
|
||||
|
||||
### 使用 Ubuntu 官方镜像
|
||||
#### 使用 Ubuntu 官方镜像
|
||||
|
||||
下面以 `ubuntu:24.04` 为例,演示如何使用该镜像安装一些常用软件。
|
||||
|
||||
@@ -123,7 +123,7 @@ root@7d93de07bf76:/# curl 127.0.0.1
|
||||
|
||||
配合使用 `-p` 参数对外映射服务端口,可以允许容器外来访问该服务。
|
||||
|
||||
## 相关资源
|
||||
### 相关资源
|
||||
|
||||
* `Debian` 官网:https://www.debian.org/
|
||||
* `Neuro Debian` 官网:http://neuro.debian.net/
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# 本章小结
|
||||
## 本章小结
|
||||
|
||||
本章讲解了典型操作系统镜像的下载和使用。
|
||||
|
||||
|
||||
Reference in New Issue
Block a user