From 70364e06412922c8d5bab1026b0a57bcec574583 Mon Sep 17 00:00:00 2001 From: Troray Date: Sat, 6 Jan 2024 15:47:06 +0800 Subject: [PATCH] Modify the restart policy of docker to `unless-stopped` (#295) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * “完善宝塔面板反向代理教程” * update reverse-proxy.md * Update reverse-proxy.md 修正图片路径 * Update reverse-proxy.md * Update bt_reverse_proxy.png * 新增docker-compose.yml 修改重启策略为unless-stopped * Revert "新增docker-compose.yml" This reverts commit 3785e7944c38dcedc80677d7b06bfe051824d8ca. * Modify the restart policy to 'unless-stopped' Added a new docker-compose.yml --------- Co-authored-by: hiqz Co-authored-by: troray --- docs/.vuepress/public/docker-compose.yml | 14 +++++++++++ docs/guide/install/docker.md | 25 +++++++++++++------- docs/zh/guide/install/docker.md | 30 +++++++++++++++++------- 3 files changed, 53 insertions(+), 16 deletions(-) create mode 100644 docs/.vuepress/public/docker-compose.yml diff --git a/docs/.vuepress/public/docker-compose.yml b/docs/.vuepress/public/docker-compose.yml new file mode 100644 index 000000000..d81267168 --- /dev/null +++ b/docs/.vuepress/public/docker-compose.yml @@ -0,0 +1,14 @@ +version: '3.3' +services: + alist: + image: 'xhofe/alist:latest' + container_name: alist + volumes: + - './:/opt/alist/data' + ports: + - '5244:5244' + environment: + - PUID=0 + - PGID=0 + - UMASK=022 + restart: unless-stopped diff --git a/docs/guide/install/docker.md b/docs/guide/install/docker.md index 16b40841c..6e1accd10 100644 --- a/docs/guide/install/docker.md +++ b/docs/guide/install/docker.md @@ -42,16 +42,26 @@ docker exec -it alist ./alist admin set NEW_PASSWORD #### **docker-cli** ```bash -docker run -d --restart=always -v /etc/alist:/opt/alist/data -p 5244:5244 -e PUID=0 -e PGID=0 -e UMASK=022 --name="alist" xhofe/alist:latest +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.** + ```yaml version: '3.3' services: alist: - restart: always + image: 'xhofe/alist:latest' + container_name: alist volumes: - '/etc/alist:/opt/alist/data' ports: @@ -60,8 +70,7 @@ services: - PUID=0 - PGID=0 - UMASK=022 - container_name: alist - image: 'xhofe/alist:latest' + restart: unless-stopped ``` ### **Offline download with aria2** @@ -74,7 +83,7 @@ Just for amd64/arm64. Not recommended, this may can't work properly. #### **docker-cli** ```bash -docker run -d --restart=always -v /etc/alist:/opt/alist/data -p 5244:5244 -e PUID=0 -e PGID=0 -e UMASK=022 --name="alist" xhofe/alist:main +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:main ``` #### **docker-compose** @@ -83,7 +92,8 @@ docker run -d --restart=always -v /etc/alist:/opt/alist/data -p 5244:5244 -e PUI version: '3.3' services: alist: - restart: always + image: 'xhofe/alist:main' + container_name: alist volumes: - '/etc/alist:/opt/alist/data' ports: @@ -92,8 +102,7 @@ services: - PUID=0 - PGID=0 - UMASK=022 - container_name: alist - image: 'xhofe/alist:main' + restart: unless-stopped ``` ### **Specify version** diff --git a/docs/zh/guide/install/docker.md b/docs/zh/guide/install/docker.md index 96d9d1719..5275034c4 100644 --- a/docs/zh/guide/install/docker.md +++ b/docs/zh/guide/install/docker.md @@ -43,7 +43,7 @@ docker exec -it alist ./alist admin set NEW_PASSWORD ##### **docker-cli** ```bash -docker run -d --restart=always -v /etc/alist:/opt/alist/data -p 5244:5244 -e PUID=0 -e PGID=0 -e UMASK=022 --name="alist" xhofe/alist:latest +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** @@ -51,7 +51,8 @@ docker run -d --restart=always -v /etc/alist:/opt/alist/data -p 5244:5244 -e PUI version: '3.3' services: alist: - restart: always + image: 'xhofe/alist:latest' + container_name: alist volumes: - '/etc/alist:/opt/alist/data' ports: @@ -60,8 +61,7 @@ services: - PUID=0 - PGID=0 - UMASK=022 - container_name: alist - image: 'xhofe/alist:latest' + restart: unless-stopped ``` ### **使用 aria2 离线下载** @@ -75,15 +75,30 @@ services: ##### **docker-cli** ```bash -docker run -d --restart=always -v /etc/alist:/opt/alist/data -p 5244:5244 -e PUID=0 -e PGID=0 -e UMASK=022 --name="alist" xhofe/alist:main +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:main ``` ##### **docker-compose** + +```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`文件** + ```yaml version: '3.3' services: alist: - restart: always + image: 'xhofe/alist:main' + container_name: alist volumes: - '/etc/alist:/opt/alist/data' ports: @@ -92,8 +107,7 @@ services: - PUID=0 - PGID=0 - UMASK=022 - container_name: alist - image: 'xhofe/alist:main' + restart: unless-stopped ``` ### **指定版本**