diff --git a/docs/guide/install/docker.md b/docs/guide/install/docker.md index 0287f3ffe..56bb7a041 100644 --- a/docs/guide/install/docker.md +++ b/docs/guide/install/docker.md @@ -18,182 +18,125 @@ star: true # Use Docker -## See the admin's info: +## Install -#### Lower than v3.25.0 - -```bash -docker exec -it alist ./alist admin -``` - -#### Higher than v3.25.0 - -Versions above 3.25.0 change the password to an encrypted hash value, and the password cannot be calculated directly. If the password is forgotten, it can only be re-**`randomly generated`** or **`manually set`** - -```bash -# Randomly generate a password -docker exec -it alist ./alist admin random -# Manually set a password, `NEW_PASSWORD` refers to the password you need to set -docker exec -it alist ./alist admin set NEW_PASSWORD -``` - -## **Release version** - -#### **docker-cli** +#### **docker cli** ```bash docker run -d --restart=unless-stopped -v /etc/alist:/opt/alist/data -p 5244:5244 -e PUID=0 -e PGID=0 -e UMASK=022 --name="alist" xhofe/alist:latest ``` -#### **docker-compose** - -```bash -mkdir /etc/alist -cd /etc/alist -wget https://alist.nn.ci/docker-compose.yml -docker-compose up -d -``` - -**Alternatively, you can manually create a `docker-compose.yml` file with the following content.** +#### **docker compose** ```yaml version: '3.3' services: - alist: - image: 'xhofe/alist:latest' - container_name: alist - volumes: - - '/etc/alist:/opt/alist/data' - ports: - - '5244:5244' - environment: - - PUID=0 - - PGID=0 - - UMASK=022 - restart: unless-stopped + alist: + image: 'xhofe/alist:beta' + container_name: alist + volumes: + - '/etc/alist:/opt/alist/data' + ports: + - '5244:5244' + environment: + - PUID=0 + - PGID=0 + - UMASK=022 + restart: unless-stopped ``` -After the service runs, the default time zone for the container is UTC time zone. If you want to specify the time zone for the container to run, you can achieve this by passing this variable:`-e "TZ=Asia/Shanghai"`。 - -### **Offline download with aria2** -If you want to use aria2 to offline download, we recommend you to use this [image](https://hub.docker.com/r/xhofe/alist-aria2), which carries a pre-installed aria2. +#### **Env** -### **Dev version** -Just for amd64/arm64. Not recommended, this may can't work properly. +| Name | Default | Desc | +|:------------|:--------|----------------------------------------------------------------------------------------------------------------------------| +| `PUID` | `0` | User UID | +| `PGID` | `0` | User GID | +| `UMASK` | `022` | https://en.wikipedia.org/wiki/Umask | +| `RUN_ARIA2` | | Whether to run ARIA2 concurrently, default is `true` if aria2 is pre-installed, otherwise it is `false`. | +| `TZ` | | Default is the UTC time zone. If you want to specify a time zone, you can set this variable, for example: `Asia/Shanghai`. | -#### **docker-cli** +#### **Image Versions** -```bash -docker run -d --restart=unless-stopped -v /etc/alist:/opt/alist/data -p 5244:5244 -e PUID=0 -e PGID=0 -e UMASK=022 --name="alist" xhofe/alist:beta -``` +Stable version: `xhofe/alist:latest` or specify a specific version, such as `xhofe/alist:v3.41.0` `xhofe/alist:v3.40.0` -#### **docker-compose** +Latest image version, please refer to https://hub.docker.com/r/xhofe/alist/tags -```yaml -version: '3.3' -services: - alist: - image: 'xhofe/alist:beta' - container_name: alist - volumes: - - '/etc/alist:/opt/alist/data' - ports: - - '5244:5244' - environment: - - PUID=0 - - PGID=0 - - UMASK=022 - restart: unless-stopped -``` +Dev version: `xhofe/alist:beta` -### **Specify version** -See https://hub.docker.com/r/xhofe/alist for details +Pre-installed environment image suffix: -### **Image with built-in ffmpeg** +| Suffix | Desc | +|:---------|-------------------------------------------------------------------------| +| `aio` | An image that includes all of the following pre-installed environments. | +| `ffmpeg` | Pre-installed FFmpeg image for generating thumbnail for local storage | +| `aria2` | Pre-installed aria2 image for offline downloading. | -You can switch to image with out-of-the-box ffmpeg environment by adding `-ffmpeg` to any image tag. +You can append a suffix using the `-` symbol after any of the mirror tags to switch to an image with the corresponding environment. For example, `xhofe/alist:latest-aio` `xhofe/alist:beta-aria2` `xhofe/alist:v3.40.0-ffmpeg` -If the thumbnail feature is still not working, please verify the following: +If the thumbnail generation function still does not work when using the pre-installed ffmpeg, please confirm: + You are using local storage + Switched to grid view + The thumbnail switch in local storage driver settings is enabled + The configuration path for the thumbnail cache folder in local storage is correct, for example, `data/thumbnail` -::: tabs#Docker-ffmpeg +When using a pre-installed aria2 mirror, you might see errors like the following in the alist logs: -@tab latest +``` +ERRO[2022-11-20 12:05:19] error [unaligned 64-bit atomic operation] while run task [download http://xxx.com/xxx.png to [/ftp](/)] +``` -**docker-cli** +The solution is, if the CPU architecture is 64-bit, you can try to manually pull a 64-bit image or rebuild the container. If the CPU architecture is 32-bit, there is currently no available solution. -```bash -docker run -d --restart=unless-stopped -v /etc/alist:/opt/alist/data -p 5244:5244 -e PUID=0 -e PGID=0 -e UMASK=022 --name="alist" xhofe/alist:latest-ffmpeg -``` +## See the admin's info: -**docker-compose** +#### Lower than v3.25.0 ```bash -version: '3.3' -services: - alist: - image: 'xhofe/alist:latest-ffmpeg' - container_name: alist - volumes: - - '/etc/alist:/opt/alist/data' - ports: - - '5244:5244' - environment: - - PUID=0 - - PGID=0 - - UMASK=022 - restart: unless-stopped +docker exec -it alist ./alist admin ``` -@tab beta +#### Higher than v3.25.0 -**docker-cli** +Versions above 3.25.0 change the password to an encrypted hash value, and the password cannot be calculated directly. If the password is forgotten, it can only be re-**`randomly generated`** or **`manually set`** ```bash -docker run -d --restart=unless-stopped -v /etc/alist:/opt/alist/data -p 5244:5244 -e PUID=0 -e PGID=0 -e UMASK=022 --name="alist" xhofe/alist:beta-ffmpeg +# Randomly generate a password +docker exec -it alist ./alist admin random +# Manually set a password, `NEW_PASSWORD` refers to the password you need to set +docker exec -it alist ./alist admin set NEW_PASSWORD ``` -**docker-compose** - -```bash -version: '3.3' -services: - alist: - image: 'xhofe/alist:beta-ffmpeg' - container_name: alist - volumes: - - '/etc/alist:/opt/alist/data' - ports: - - '5244:5244' - environment: - - PUID=0 - - PGID=0 - - UMASK=022 - restart: unless-stopped -``` +## **Update** +::: details docker-cli update +1. docker ps -a #View the container (find the ID of the Alist container) +2. docker stop ID #Stop Alist running, otherwise it cannot be deleted (this time the ID of the Alist container is d429749a6e69, it is different for each installation) +3. docker rm ID #Delete the Alist container (the data is still there as long as you don't delete it manually) +4. docker pull xhofe/alist:latest +5. [Enter the installation command and click to view](#docker-cli) +6. The update is complete, go and have a look.. It's that simple +**There is a missing step in the picture, it is step 4 in the tutorial....remember to execute** +![docker](/img/faq/updocker.png) ::: -### **User / Group Identifiers** +:::details docker-compose update +1. docker-compose pull -When using volumes (`-v` flags) permissions issues can arise between the host OS and the container, we avoid this issue by allowing you to specify the user `PUID` and group `PGID`. +2. docker-compose up -d -Ensure any volume directories on the host are owned by the same user you specify and any permissions issues will vanish like magic. +::: -In this instance `PUID=1000` and `PGID=1000`, to find yours use `id user` as below: +Q: My version is v3.x.x and I cannot upgrade to the latest version. `docker pull xhofe/alist:latest` does not work to pull the latest version. After changing to docker-compose, it is still version 3.x.x -```bash - $ id username - uid=1000(dockeruser) gid=1000(dockergroup) groups=1000(dockergroup) -``` +A: The reason is that your docker has set up a mirror, and the latest version cannot be updated from the mirror, so modify /etc/docker/daemon.json and delete "registry-mirrors": ["mirror accelerator address"] + +- If deletion doesn’t work, you can consider replacing it with a `mirror acceleration address` +- Or simple and rude: when downloading, replace `xhofe/alist:latest` with `xhofe/alist:v3.16.3` (specify the version, the latest when writing the tutorial is 3.16.3) -### **Manually build Docker image** +### **Compile Image** -Install Docker, clone the repository, and navigate to the root directory of the repository, no additional preparation is needed. +Install Docker, clone the repository, then navigate to the root directory of the repository. No further preparation is required. ::: tabs#Docker-build @@ -203,7 +146,7 @@ Install Docker, clone the repository, and navigate to the root directory of the docker build -t xhofe/alist:latest . ``` -@tab with ffmpeg +@tab build-arg ```bash docker build -t xhofe/alist:latest-ffmpeg --build-arg INSTALL_FFMPEG=true . @@ -211,44 +154,10 @@ docker build -t xhofe/alist:latest-ffmpeg --build-arg INSTALL_FFMPEG=true . ::: -## **Additional notes about the offline download feature** - -If the image is not pulled using the '''docker pull --platform''' parameter, docker may pull the 32-bit image on the 64-bit operating system, which may cause the offline download function to be unavailable even under normal configuration. - -When an error occurs, you will see a similar error log in Alist's log file. - -```ERRO[2022-11-20 12:05:19] error [unaligned 64-bit atomic operation] while run task [download http://pic.rmb.bdstatic.com/bjh/34ee946f7a74435a167ca4351d723374.png to [/ftp](/)]``` - -Solution, if the CPU architecture is 64-bit, try to manually pull the 64-bit docker image, rebuild the container, and try again. - -If the CPU architecture is 32-bit, there is currently no solution available. - - - -## **How to update Docker installation?** - -::: details docker-cli update -1. docker ps -a #View the container (find the ID of the Alist container) -2. docker stop ID #Stop Alist running, otherwise it cannot be deleted (this time the ID of the Alist container is d429749a6e69, it is different for each installation) -3. docker rm ID #Delete the Alist container (the data is still there as long as you don't delete it manually) -4. docker pull xhofe/alist:latest -5. [Enter the installation command and click to view](#docker-cli) -6. The update is complete, go and have a look.. It's that simple - -**There is a missing step in the picture, it is step 4 in the tutorial....remember to execute** -![docker](/img/faq/updocker.png) -::: - -:::details docker-compose update -1. docker-compose pull - -2. docker-compose up -d - -::: - -Q: My version is v3.x.x and I cannot upgrade to the latest version. `docker pull xhofe/alist:latest` does not work to pull the latest version. After changing to docker-compose, it is still version 3.x.x -A: The reason is that your docker has set up a mirror, and the latest version cannot be updated from the mirror, so modify /etc/docker/daemon.json and delete "registry-mirrors": ["mirror accelerator address"] +Available build args: -- If deletion doesn’t work, you can consider replacing it with a `mirror acceleration address` -- Or simple and rude: when downloading, replace `xhofe/alist:latest` with `xhofe/alist:v3.16.3` (specify the version, the latest when writing the tutorial is 3.16.3) \ No newline at end of file +| | Desc | +|:----------------------|----------------| +| `INSTALL_FFMPEG=true` | Install ffmpeg | +| `INSTALL_ARIA2=true` | Install aria2 | diff --git a/docs/zh/guide/install/docker.md b/docs/zh/guide/install/docker.md index a2e55d2bb..c8ceed06a 100644 --- a/docs/zh/guide/install/docker.md +++ b/docs/zh/guide/install/docker.md @@ -18,220 +18,97 @@ star: true # 使用 Docker -## **查看管理员信息:** - -#### **低于v3.25.0版本** - -```bash -docker exec -it alist ./alist admin -``` - - -#### **高于v3.25.0版本** - -3.25.0以上版本将密码改成加密方式存储的hash值,无法直接反算出密码,如果忘记了密码只能通过重新 **`随机生成`** 或者 **`手动设置`** - -```bash -# 随机生成一个密码 -docker exec -it alist ./alist admin random -# 手动设置一个密码,`NEW_PASSWORD`是指你需要设置的密码 -docker exec -it alist ./alist admin set NEW_PASSWORD -``` - -## **发行版本** +## **安装** -##### **docker-cli** +#### **docker cli** ```bash docker run -d --restart=unless-stopped -v /etc/alist:/opt/alist/data -p 5244:5244 -e PUID=0 -e PGID=0 -e UMASK=022 --name="alist" xhofe/alist:latest ``` -##### **docker-compose** +#### **docker compose** ```yaml version: '3.3' services: - alist: - image: 'xhofe/alist:latest' - container_name: alist - volumes: - - '/etc/alist:/opt/alist/data' - ports: - - '5244:5244' - environment: - - PUID=0 - - PGID=0 - - UMASK=022 - restart: unless-stopped + alist: + image: 'xhofe/alist:beta' + container_name: alist + volumes: + - '/etc/alist:/opt/alist/data' + ports: + - '5244:5244' + environment: + - PUID=0 + - PGID=0 + - UMASK=022 + restart: unless-stopped ``` -服务运行之后,容器默认的时区为UTC时区,如果你想指定容器运行的时区,则可以通过传递此变量来实现:`-e "TZ=Asia/Shanghai"`。 - -### **使用 aria2 离线下载** - -如果你想使用aria2离线下载,我们推荐你使用这个[image](https://hub.docker.com/r/xhofe/alist-aria2),它预装了aria2。 - -### **开发版本** - -仅适用于 amd64/arm64。不推荐,这可能无法正常工作。 - -##### **docker-cli** - -```bash -docker run -d --restart=unless-stopped -v /etc/alist:/opt/alist/data -p 5244:5244 -e PUID=0 -e PGID=0 -e UMASK=022 --name="alist" xhofe/alist:beta -``` +#### **环境变量** -##### **docker-compose** +| 名称 | 默认值 | 说明 | +|:------------|:------|----------------------------------------------------| +| `PUID` | `0` | 运行身份 UID | +| `PGID` | `0` | 运行身份 GID | +| `UMASK` | `022` | https://en.wikipedia.org/wiki/Umask | +| `RUN_ARIA2` | | 是否同时运行 ARIA2,当镜像含有 aria2 环境时默认为 `true`,否则为 `false` | +| `TZ` | | 默认为 UTC 时区,如果你想指定时区,则可以设置此变量,例如:`Asia/Shanghai` | -```bash -#创建一个目录 -mkdir /etc/alist -#进入该目录 -cd /etc/alist -#下载docker-compose.yml文件 -wget https://alist.nn.ci/docker-compose.yml -#运行容器 -docker-compose up -d -``` +#### **镜像版本** -**你也可以自行创建一个包含以下内容的`docker-compose.yml`文件** +稳定版:`xhofe/alist:latest` 或指定本版,如 `xhofe/alist:v3.41.0` `xhofe/alist:v3.40.0` -```yaml -version: '3.3' -services: - alist: - image: 'xhofe/alist:beta' - container_name: alist - volumes: - - '/etc/alist:/opt/alist/data' - ports: - - '5244:5244' - environment: - - PUID=0 - - PGID=0 - - UMASK=022 - restart: unless-stopped -``` +最新镜像版本,请参阅 https://hub.docker.com/r/xhofe/alist/tags -### **指定版本** +开发版:`xhofe/alist:beta` -有关详细信息,请参阅 https://hub.docker.com/r/xhofe/alist +预装环境镜像后缀: -### **内置 ffmpeg 版镜像** +| 后缀 | 说明 | +|:----------|-------------------------| +| `aio` | 同时包含下列所有预装环境的镜像 | +| `ffmpeg` | 预装 ffmpeg 的镜像,用于本地存储缩略图 | +| `aria2` | 预装 aria2 的镜像,用于离线下载 | -在任何镜像 tag 后添加 `-ffmpeg` 即可切换到带有开箱即用的 ffmpeg 环境版本镜像 +你可以在上述任意镜像标签后面,使用 `-` 符号附加后缀以切换到附带环境的镜像。如 `xhofe/alist:latest-aio` `xhofe/alist:beta-aria2` `xhofe/alist:v3.40.0-ffmpeg` -如果缩略图功能仍无法使用,请确认: +如果使用预装 ffmpeg 镜像缩略图功能仍无法使用,请确认: + 使用的是本地存储 + 切换到网格视图 + 本地存储的缩略图开关开启 + 本地存储的缩略图缓存文件夹配置路径正确,例如 `data/thumbnail` -::: tabs#Docker-ffmpeg - -@tab 正式版 - -**docker-cli** - -```bash -docker run -d --restart=unless-stopped -v /etc/alist:/opt/alist/data -p 5244:5244 -e PUID=0 -e PGID=0 -e UMASK=022 --name="alist" xhofe/alist:latest-ffmpeg -``` - -**docker-compose** +当使用预装 aria2 镜像时,可能会在 alist 的日志中看到类似错误: -```bash -version: '3.3' -services: - alist: - image: 'xhofe/alist:latest-ffmpeg' - container_name: alist - volumes: - - '/etc/alist:/opt/alist/data' - ports: - - '5244:5244' - environment: - - PUID=0 - - PGID=0 - - UMASK=022 - restart: unless-stopped ``` - -@tab 测试版 - -**docker-cli** - -```bash -docker run -d --restart=unless-stopped -v /etc/alist:/opt/alist/data -p 5244:5244 -e PUID=0 -e PGID=0 -e UMASK=022 --name="alist" xhofe/alist:beta-ffmpeg -``` - -**docker-compose** - -```bash -version: '3.3' -services: - alist: - image: 'xhofe/alist:beta-ffmpeg' - container_name: alist - volumes: - - '/etc/alist:/opt/alist/data' - ports: - - '5244:5244' - environment: - - PUID=0 - - PGID=0 - - UMASK=022 - restart: unless-stopped +ERRO[2022-11-20 12:05:19] error [unaligned 64-bit atomic operation] while run task [download http://xxx.com/xxx.png to [/ftp](/)] ``` -::: - -### **用户/组标识符** - -当使用卷(`-v` 标志)权限问题时,主机操作系统和容器之间可能会出现权限问题,我们通过允许您指定用户 `PUID` 和组 `PGID` 来避免此问题。 +解决方法是,如果是 CPU 架构是 64 位,可以尝试手动拉取 64 位镜像或重新构建容器。 如果是 CPU 架构是 32 位,目前尚无可用方案。 -确保主机上的任何卷目录都归您指定的同一用户所有,任何权限问题都会像魔术一样消失。 +## **查看管理员信息:** -在这种情况下,`PUID=1000` 和 `PGID=1000`,要找到你的使用 `id user`,如下所示: +#### **低于v3.25.0版本** ```bash - $ id username - uid=1000(dockeruser) gid=1000(dockergroup) groups=1000(dockergroup) +docker exec -it alist ./alist admin ``` -### **手动编译 Docker 镜像** - -安装 docker,克隆仓库后进入仓库根目录,无需其他准备 - -::: tabs#Docker-build - -@tab basic -```bash -docker build -t xhofe/alist:latest . -``` +#### **高于v3.25.0版本** -@tab with ffmpeg +3.25.0以上版本将密码改成加密方式存储的hash值,无法直接反算出密码,如果忘记了密码只能通过重新 **`随机生成`** 或者 **`手动设置`** ```bash -docker build -t xhofe/alist:latest-ffmpeg --build-arg INSTALL_FFMPEG=true . +# 随机生成一个密码 +docker exec -it alist ./alist admin random +# 手动设置一个密码,`NEW_PASSWORD`是指你需要设置的密码 +docker exec -it alist ./alist admin set NEW_PASSWORD ``` -::: - -## **有关离线下载功能的额外说明** - -若没有使用```docker pull --platform```参数拉取镜像时,docker可能会在64位操作系统上拉取32位镜像,这将可能导致离线下载功能即使在正常配置情况下也无法使用。 - -当发生错误时,您会在Alist的日志文件中看到类似错误日志。 - -```ERRO[2022-11-20 12:05:19] error [unaligned 64-bit atomic operation] while run task [download http://pic.rmb.bdstatic.com/bjh/34ee946f7a74435a167ca4351d723374.png to [/ftp](/)]``` - -解决方法,如果是CPU架构是64位,尝试手动拉取64位docker镜像,重新构建容器,再次尝试。 - -如果是CPU架构是32位,目前尚无可用方案。 - -## **Docker安装怎么更新?** +## **更新** ::: details docker-cli 更新 @@ -263,4 +140,32 @@ Q:我的版本是v3.x.x 怎么也升级不到最新版 `docker pull xhofe/alis A:原因是你的docker设置了镜像,从镜像更新不到最新版本,改一下/etc/docker/daemon.json,删除"registry-mirrors": ["镜像加速器地址"] - 删除若不行,可以考虑更换一个`镜像加速地址` -- 或者简单粗暴:下载时将`xhofe/alist:latest` 替换为`xhofe/alist:v3.16.3`(指定版本,写教程时最新的是3.16.3) \ No newline at end of file +- 或者简单粗暴:下载时将`xhofe/alist:latest` 替换为`xhofe/alist:v3.16.3`(指定版本,写教程时最新的是3.16.3) + +### **编译镜像** + +安装 docker,克隆仓库后进入仓库根目录,无需其他准备 + +::: tabs#Docker-build + +@tab basic + +```bash +docker build -t xhofe/alist:latest . +``` + +@tab build-arg + +```bash +docker build -t xhofe/alist:latest-ffmpeg --build-arg INSTALL_FFMPEG=true . +``` + +::: + + +可用 build args: + +| | 说明 | +|:----------------------|-----------| +| `INSTALL_FFMPEG=true` | 安装 ffmpeg | +| `INSTALL_ARIA2=true` | 安装 aria2 | \ No newline at end of file