Skip to content

Conversation

@dezhishen
Copy link
Member

@dezhishen dezhishen commented Aug 11, 2025

must merge the docker-library#12 first

测试镜像

base-image: dezhishen/openlist-base-image:aio
office-base-image: openlistteam/openlist-base-image:aio
test-image: dezhishen/openlist:aio-test

测试

构建自己的镜像

git clone https://github.com/dezhishen/OpenList.git openlist-aio-test
cd openlist-aio-test
git checkout docker-add-default-user
docker pull openlistteam/openlist-base-image:aio `# 保证最新的基础镜像`
docker build . -f Dockerfile -t openlist:aio-test --build-arg INSTALL_FFMPEG=true --build-arg INSTALL_ARIA2=true --build-arg BASE_IMAGE_TAG=aio

运行测试镜像

mkdir -p data
docker run --user `id -u`:`id -g` -v `pwd`/data:/opt/openlist/data -p 15244:5244 --name openlist-test --rm  -d openlist:aio-test

查看日志

docker logs -f openlist-test

INFO[2025-08-11 08:10:43] reading config file: /opt/openlist/data/config.json 
INFO[2025-08-11 08:10:43] config file not exists, creating default config file 
INFO[2025-08-11 08:10:43] max buffer limit: 836763648                  
INFO[2025-08-11 08:10:43] load config from env with prefix:            
INFO[2025-08-11 08:10:43] init logrus...                               
Successfully created the admin user and the initial password is: aNmfSBhq
start HTTP server @ 0.0.0.0:5244

查看文件夹权限

docker exec -it openlist-test ls -l /opt/service/start/
total 8
drwxr-xr-x    4 1000     1000          4096 Aug 11 08:10 aria2
drwxr-xr-x    3 1000     1000          4096 Aug 11 08:10 openlist
docker exec -it openlist-test ls -l /opt/openlist/data
total 244
-rw-r--r--    1 1000     1000          2768 Aug 11 08:10 config.json
-rw-r--r--    1 1000     1000          4096 Aug 11 08:10 data.db
-rw-r--r--    1 1000     1000         32768 Aug 11 08:10 data.db-shm
-rw-r--r--    1 1000     1000        197792 Aug 11 08:10 data.db-wal
drwxr-xr-x    3 1000     1000          4096 Aug 11 08:10 log
drwxr-xr-x    2 1000     1000          4096 Aug 11 08:10 temp

This comment was marked as outdated.

@dezhishen dezhishen marked this pull request as draft August 11, 2025 06:25
@dezhishen dezhishen requested a review from Copilot August 11, 2025 06:28
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds a default user configuration for Docker execution, improving security by running the container as a non-root user instead of root. The changes implement proper user creation and permission management in Docker containers.

Key changes:

  • Adds user creation with configurable UID/GID in Dockerfiles
  • Removes dynamic user switching from entrypoint script
  • Improves aria2 service management with proper directory handling

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
Dockerfile Adds user creation with default openlist user (UID 1001) and sets USER directive
Dockerfile.ci Mirrors the user configuration changes from main Dockerfile
entrypoint.sh Removes su-exec user switching and improves aria2 directory management logic

@dezhishen dezhishen marked this pull request as ready for review August 11, 2025 07:54
jyxjjj
jyxjjj previously approved these changes Aug 12, 2025
elysia-best
elysia-best previously approved these changes Aug 12, 2025
TARGETPLATFORM only used in ci

Signed-off-by: 我怎么就不是一只猫呢? <[email protected]>
@dezhishen dezhishen dismissed stale reviews from elysia-best and jyxjjj via 66330cd August 12, 2025 01:34
@dezhishen dezhishen merged commit d0c22a1 into OpenListTeam:main Aug 12, 2025
12 checks passed
@xrgzs
Copy link
Member

xrgzs commented Aug 17, 2025

@dezhishen 发现个问题,仓库里面的 docker-compose.yml 没改

https://github.com/OpenListTeam/OpenList/blob/main/docker-compose.yml

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants