Skip to content

Commit 00aa292

Browse files
authored
feat: refactor docker installation guide (#397)
1 parent d41312f commit 00aa292

File tree

2 files changed

+153
-339
lines changed

2 files changed

+153
-339
lines changed

docs/guide/install/docker.md

Lines changed: 76 additions & 167 deletions
Original file line numberDiff line numberDiff line change
@@ -18,182 +18,125 @@ star: true
1818

1919
# Use Docker
2020

21-
## See the admin's info:
21+
## Install
2222

23-
#### Lower than v3.25.0
24-
25-
```bash
26-
docker exec -it alist ./alist admin
27-
```
28-
29-
#### Higher than v3.25.0
30-
31-
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`**
32-
33-
```bash
34-
# Randomly generate a password
35-
docker exec -it alist ./alist admin random
36-
# Manually set a password, `NEW_PASSWORD` refers to the password you need to set
37-
docker exec -it alist ./alist admin set NEW_PASSWORD
38-
```
39-
40-
## **Release version**
41-
42-
#### **docker-cli**
23+
#### **docker cli**
4324

4425
```bash
4526
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
4627
```
4728

48-
#### **docker-compose**
49-
50-
```bash
51-
mkdir /etc/alist
52-
cd /etc/alist
53-
wget https://alist.nn.ci/docker-compose.yml
54-
docker-compose up -d
55-
```
56-
57-
**Alternatively, you can manually create a `docker-compose.yml` file with the following content.**
29+
#### **docker compose**
5830

5931
```yaml
6032
version: '3.3'
6133
services:
62-
alist:
63-
image: 'xhofe/alist:latest'
64-
container_name: alist
65-
volumes:
66-
- '/etc/alist:/opt/alist/data'
67-
ports:
68-
- '5244:5244'
69-
environment:
70-
- PUID=0
71-
- PGID=0
72-
- UMASK=022
73-
restart: unless-stopped
34+
alist:
35+
image: 'xhofe/alist:beta'
36+
container_name: alist
37+
volumes:
38+
- '/etc/alist:/opt/alist/data'
39+
ports:
40+
- '5244:5244'
41+
environment:
42+
- PUID=0
43+
- PGID=0
44+
- UMASK=022
45+
restart: unless-stopped
7446
```
75-
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"`。
76-
77-
### **Offline download with aria2**
7847
79-
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.
48+
#### **Env**
8049
81-
### **Dev version**
82-
Just for amd64/arm64. Not recommended, this may can't work properly.
50+
| Name | Default | Desc |
51+
|:------------|:--------|----------------------------------------------------------------------------------------------------------------------------|
52+
| `PUID` | `0` | User UID |
53+
| `PGID` | `0` | User GID |
54+
| `UMASK` | `022` | https://en.wikipedia.org/wiki/Umask |
55+
| `RUN_ARIA2` | | Whether to run ARIA2 concurrently, default is `true` if aria2 is pre-installed, otherwise it is `false`. |
56+
| `TZ` | | Default is the UTC time zone. If you want to specify a time zone, you can set this variable, for example: `Asia/Shanghai`. |
8357

84-
#### **docker-cli**
58+
#### **Image Versions**
8559

86-
```bash
87-
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
88-
```
60+
Stable version: `xhofe/alist:latest` or specify a specific version, such as `xhofe/alist:v3.41.0` `xhofe/alist:v3.40.0`
8961

90-
#### **docker-compose**
62+
Latest image version, please refer to https://hub.docker.com/r/xhofe/alist/tags
9163

92-
```yaml
93-
version: '3.3'
94-
services:
95-
alist:
96-
image: 'xhofe/alist:beta'
97-
container_name: alist
98-
volumes:
99-
- '/etc/alist:/opt/alist/data'
100-
ports:
101-
- '5244:5244'
102-
environment:
103-
- PUID=0
104-
- PGID=0
105-
- UMASK=022
106-
restart: unless-stopped
107-
```
64+
Dev version: `xhofe/alist:beta`
10865

109-
### **Specify version**
110-
See https://hub.docker.com/r/xhofe/alist for details
66+
Pre-installed environment image suffix:
11167

112-
### **Image with built-in ffmpeg**
68+
| Suffix | Desc |
69+
|:---------|-------------------------------------------------------------------------|
70+
| `aio` | An image that includes all of the following pre-installed environments. |
71+
| `ffmpeg` | Pre-installed FFmpeg image for generating thumbnail for local storage |
72+
| `aria2` | Pre-installed aria2 image for offline downloading. |
11373

114-
You can switch to image with out-of-the-box ffmpeg environment by adding `-ffmpeg` to any image tag.
74+
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`
11575

116-
If the thumbnail feature is still not working, please verify the following:
76+
If the thumbnail generation function still does not work when using the pre-installed ffmpeg, please confirm:
11777

11878
+ You are using local storage
11979
+ Switched to grid view
12080
+ The thumbnail switch in local storage driver settings is enabled
12181
+ The configuration path for the thumbnail cache folder in local storage is correct, for example, `data/thumbnail`
12282

123-
::: tabs#Docker-ffmpeg
83+
When using a pre-installed aria2 mirror, you might see errors like the following in the alist logs:
12484

125-
@tab latest
85+
```
86+
ERRO[2022-11-20 12:05:19] error [unaligned 64-bit atomic operation] while run task [download http://xxx.com/xxx.png to [/ftp](/)]
87+
```
12688

127-
**docker-cli**
89+
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.
12890

129-
```bash
130-
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
131-
```
91+
## See the admin's info:
13292

133-
**docker-compose**
93+
#### Lower than v3.25.0
13494

13595
```bash
136-
version: '3.3'
137-
services:
138-
alist:
139-
image: 'xhofe/alist:latest-ffmpeg'
140-
container_name: alist
141-
volumes:
142-
- '/etc/alist:/opt/alist/data'
143-
ports:
144-
- '5244:5244'
145-
environment:
146-
- PUID=0
147-
- PGID=0
148-
- UMASK=022
149-
restart: unless-stopped
96+
docker exec -it alist ./alist admin
15097
```
15198

152-
@tab beta
99+
#### Higher than v3.25.0
153100

154-
**docker-cli**
101+
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`**
155102

156103
```bash
157-
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
104+
# Randomly generate a password
105+
docker exec -it alist ./alist admin random
106+
# Manually set a password, `NEW_PASSWORD` refers to the password you need to set
107+
docker exec -it alist ./alist admin set NEW_PASSWORD
158108
```
159109

160-
**docker-compose**
161-
162-
```bash
163-
version: '3.3'
164-
services:
165-
alist:
166-
image: 'xhofe/alist:beta-ffmpeg'
167-
container_name: alist
168-
volumes:
169-
- '/etc/alist:/opt/alist/data'
170-
ports:
171-
- '5244:5244'
172-
environment:
173-
- PUID=0
174-
- PGID=0
175-
- UMASK=022
176-
restart: unless-stopped
177-
```
110+
## **Update**
111+
::: details docker-cli update
112+
1. docker ps -a #View the container (find the ID of the Alist container)
113+
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)
114+
3. docker rm ID #Delete the Alist container (the data is still there as long as you don't delete it manually)
115+
4. docker pull xhofe/alist:latest
116+
5. [Enter the installation command and click to view](#docker-cli)
117+
6. The update is complete, go and have a look.. It's that simple
178118

119+
**There is a missing step in the picture, it is step 4 in the tutorial....remember to execute**
120+
![docker](/img/faq/updocker.png)
179121
:::
180122

181-
### **User / Group Identifiers**
123+
:::details docker-compose update
124+
1. docker-compose pull
182125

183-
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`.
126+
2. docker-compose up -d
184127

185-
Ensure any volume directories on the host are owned by the same user you specify and any permissions issues will vanish like magic.
128+
:::
186129

187-
In this instance `PUID=1000` and `PGID=1000`, to find yours use `id user` as below:
130+
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
188131

189-
```bash
190-
$ id username
191-
uid=1000(dockeruser) gid=1000(dockergroup) groups=1000(dockergroup)
192-
```
132+
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"]
133+
134+
- If deletion doesn’t work, you can consider replacing it with a `mirror acceleration address`
135+
- 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)
193136

194-
### **Manually build Docker image**
137+
### **Compile Image**
195138

196-
Install Docker, clone the repository, and navigate to the root directory of the repository, no additional preparation is needed.
139+
Install Docker, clone the repository, then navigate to the root directory of the repository. No further preparation is required.
197140

198141
::: tabs#Docker-build
199142

@@ -203,52 +146,18 @@ Install Docker, clone the repository, and navigate to the root directory of the
203146
docker build -t xhofe/alist:latest .
204147
```
205148

206-
@tab with ffmpeg
149+
@tab build-arg
207150

208151
```bash
209152
docker build -t xhofe/alist:latest-ffmpeg --build-arg INSTALL_FFMPEG=true .
210153
```
211154

212155
:::
213156

214-
## **Additional notes about the offline download feature**
215-
216-
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.
217-
218-
When an error occurs, you will see a similar error log in Alist's log file.
219-
220-
```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](/)]```
221-
222-
Solution, if the CPU architecture is 64-bit, try to manually pull the 64-bit docker image, rebuild the container, and try again.
223-
224-
If the CPU architecture is 32-bit, there is currently no solution available.
225-
226-
227-
228-
## **How to update Docker installation?**
229-
230-
::: details docker-cli update
231-
1. docker ps -a #View the container (find the ID of the Alist container)
232-
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)
233-
3. docker rm ID #Delete the Alist container (the data is still there as long as you don't delete it manually)
234-
4. docker pull xhofe/alist:latest
235-
5. [Enter the installation command and click to view](#docker-cli)
236-
6. The update is complete, go and have a look.. It's that simple
237-
238-
**There is a missing step in the picture, it is step 4 in the tutorial....remember to execute**
239-
![docker](/img/faq/updocker.png)
240-
:::
241-
242-
:::details docker-compose update
243-
1. docker-compose pull
244-
245-
2. docker-compose up -d
246-
247-
:::
248-
249-
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
250157

251-
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"]
158+
Available build args:
252159

253-
- If deletion doesn’t work, you can consider replacing it with a `mirror acceleration address`
254-
- 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)
160+
| | Desc |
161+
|:----------------------|----------------|
162+
| `INSTALL_FFMPEG=true` | Install ffmpeg |
163+
| `INSTALL_ARIA2=true` | Install aria2 |

0 commit comments

Comments
 (0)