maohaodong commited on
Commit ·
fca082a
1
Parent(s): cf453fc
chore(docker): 增加非root用户以提升容器安全性
Browse files- 新建用户 user,用户ID为1000
- 切换容器运行用户为 user
- 避免使用默认的root用户运行容器
- 提升容器的安全性和权限隔离
- Dockerfile +6 -0
Dockerfile
CHANGED
|
@@ -1,2 +1,8 @@
|
|
| 1 |
# 使用原基础镜像
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
FROM ghcr.io/webtor-io/self-hosted:latest
|
|
|
|
| 1 |
# 使用原基础镜像
|
| 2 |
+
# Set up a new user named "user" with user ID 1000
|
| 3 |
+
RUN useradd -m -u 1000 user
|
| 4 |
+
|
| 5 |
+
# Switch to the "user" user
|
| 6 |
+
USER user
|
| 7 |
+
|
| 8 |
FROM ghcr.io/webtor-io/self-hosted:latest
|