Skip to content

Commit

Permalink
7
Browse files Browse the repository at this point in the history
  • Loading branch information
YiRanCN committed Mar 28, 2024
1 parent 532a4ad commit 02f21cc
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 0 deletions.
3 changes: 3 additions & 0 deletions docs/study/devops/Linux发行版.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
### OpenEuler

[OpenEuler官网](https://www.openeuler.org/zh/)
16 changes: 16 additions & 0 deletions docs/study/devops/Linux运维-自启.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Linux运维-自启

systemd和init是Linux系统中用于启动和管理系统的两个不同工具。

### init

它是Linux内核启动后的第一个用户进程,用于初始化和管理系统服务和守护进程。init使用service命令来管理服务,如启动、停止和重启服务。init的主要缺点是启动时间长,因为它在启动过程中是串行的,这意味着必须依次启动每个服务。此外,init的配置脚本较为复杂,需要自行处理各种情况,这可能导致脚本变得很长。

### systemd

它是较新的Linux系统守护进程管理工具,在CentOS 7及更高版本中,systemd取代了init作为系统的默认进程管理器。systemd提供了并行启动服务的能力,使用socket和D-Bus激活机制,这显著提高了系统的启动速度。systemd还支持SysV和LSB初始化脚本,并能够管理系统的各项功能,如日志记录、网络配置、电源管理等。systemd的核心概念包括基于依赖关系的服务控制和统一任务定义,这使得管理更加高效和简化。

### Docker systemd

- [Docker服务systemd配置文件详解](https://blog.csdn.net/qq_46207024/article/details/134006150)
- [配置 Docker 的 cgroup driver 为 systemd](https://zhuanlan.zhihu.com/p/633832183)
27 changes: 27 additions & 0 deletions docs/study/docker/Docker的使用总结.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,33 @@ systemctl restart docker
docker version
```

### run后保持运行状态

```shell
#
docker run -tid \
--privileged=true \
--name test-ubuntu \
ubuntu
```

### 绑定随机端口

```shell
#
docker run -tid \
-p :80 \
--privileged=true \
--name test-ubuntu \
ubuntu
# 重启之后 随机的端口会换掉
docker port test-ubuntu
# 重启之后 随机的端口会换掉
docker restart test-ubuntu
# 重启之后 随机的端口会换掉
docker port test-ubuntu
```

### 参考

[参考 1](https://developer.aliyun.com/article/272173)

0 comments on commit 02f21cc

Please sign in to comment.