diff --git a/README.md b/README.md index 6f750d2..5d1cdde 100644 --- a/README.md +++ b/README.md @@ -85,8 +85,32 @@ docker run --rm -it \ Note that you need to set the environment variable `RCLONE_REMOTE_NAME` to a remote name like `YouRemoteName`. +#### Use Docker Compose (Recommend) + +If you are a new user or are rebuilding vaultwarden, it is recommended to use the `docker-compose.yml` from the project. + +Download `docker-compose.yml` to you machine, edit environment variables and start it. + +You need to go to the directory where the `docker-compose.yml` file is saved. + +```shell +# Start +docker-compose up -d + +# Stop +docker-compose stop + +# Restart +docker-compose restart + +# Remove +docker-compose down +``` + #### Automatic Backups +If you have a running vaultwarden but don't want to use `docker-compose.yml`, we also provide a backup method for you. + Make sure that your vaultwarden container is named `vaultwarden` otherwise you have to replace the container name in the `--volumes-from` section of the docker run call. By default the data folder for vaultwarden is `/data`, you need to explicitly specify the data folder using the environment variable `DATA_DIR`. @@ -104,24 +128,6 @@ docker run -d \ ttionya/vaultwarden-backup:latest ``` -#### Use Docker Compose - -Download `docker-compose.yml` to you machine, edit environment variables and start it. You need to go to the directory where the `docker-compose.yml` file is saved. - -```shell -# Start -docker-compose up -d - -# Stop -docker-compose stop - -# Restart -docker-compose restart - -# Remove -docker-compose down -``` - ### Restore > **Important:** Restore will overwrite the existing files. @@ -132,7 +138,7 @@ Because the host's files are not accessible in the Docker container, you need to And go to the directory where your backup files are located. -If you are using automatic backups, please confirm the vaultwarden volume and replace the `--mount` `source` section. Also don't forget to use the environment variable `DATA_DIR` to specify the data directory (`-e DATA_DIR="/data"`). +If you use the `docker-compose.yml` provided with this project, you can use the following command. ```shell docker run --rm -it \ @@ -142,6 +148,22 @@ docker run --rm -it \ [OPTIONS] ``` +If you are using "automatic backups", please confirm the vaultwarden volume and replace the `--mount` `source` section. + +Also don't forget to use the environment variable `DATA_DIR` to specify the data directory (`-e DATA_DIR="/data"`). + +```shell +docker run --rm -it \ + \ # If you are mapping the local folder to a docker container, like `vw-data` + --mount type=bind,source="the absolution path to your local folder",target=/data/ \ + \ # If you are using docker volume + --mount type=volume,source="docker volume name",target=/data/ \ + --mount type=bind,source=$(pwd),target=/bitwarden/restore/ \ + -e DATA_DIR="/data" \ + ttionya/vaultwarden-backup:latest restore \ + [OPTIONS] +``` + See [Options](#options) for options information. #### Options diff --git a/README_zh.md b/README_zh.md index 7041ffc..ba70171 100644 --- a/README_zh.md +++ b/README_zh.md @@ -85,26 +85,9 @@ docker run --rm -it \ 需要注意的是,你要将环境变量 `RCLONE_REMOTE_NAME` 设置为远程名称,比如上面的 `YouRemoteName`。 -#### 自动备份 +#### 使用 Docker Compose (推荐) -确保你的 vaultwarden 容器被命名为 `vaultwarden`,否则你需要自行替换 docker run 的 `--volumes-from` 部分。 - -默认情况下 vaultwarden 的数据文件夹是 `/data`,你需要显式使用环境变量 `DATA_DIR` 指定数据文件夹。 - -使用默认设置启动容器(每小时的 05 分自动备份)。 - -```shell -docker run -d \ - --restart=always \ - --name vaultwarden_backup \ - --volumes-from=vaultwarden \ - --mount type=volume,source=vaultwarden-rclone-data,target=/config/ \ - -e RCLONE_REMOTE_NAME="YouRemoteName" \ - -e DATA_DIR="/data" \ - ttionya/vaultwarden-backup:latest -``` - -#### 使用 Docker Compose +如果你是新用户或正在重新搭建 vaultwarden,推荐使用项目中的 `docker-compose.yml`. 下载 `docker-compose.yml`,根据实际情况编辑环境变量后启动它。 @@ -124,6 +107,27 @@ docker-compose restart docker-compose down ``` +#### 自动备份 + +如果你有一个正在运行的 vaultwarden,但是不想使用 `docker-compose.yml`,我们同样为你提供了备份方法。 + +确保你的 vaultwarden 容器被命名为 `vaultwarden`,否则你需要自行替换 docker run 的 `--volumes-from` 部分。 + +默认情况下 vaultwarden 的数据文件夹是 `/data`,你需要显式使用环境变量 `DATA_DIR` 指定数据文件夹。 + +使用默认设置启动容器(每小时的 05 分自动备份)。 + +```shell +docker run -d \ + --restart=always \ + --name vaultwarden_backup \ + --volumes-from=vaultwarden \ + --mount type=volume,source=vaultwarden-rclone-data,target=/config/ \ + -e RCLONE_REMOTE_NAME="YouRemoteName" \ + -e DATA_DIR="/data" \ + ttionya/vaultwarden-backup:latest +``` + ### 还原备份 > **重要:** 还原备份会覆盖已存在的文件。 @@ -134,7 +138,7 @@ docker-compose down 首先进入备份文件所在目录。 -如果你使用的是自动备份,请确认 vaultwarden 卷的命名,并替换 `--mount` `source` 部分。同时不要忘记使用环境变量 `DATA_DIR` 指定数据目录(`-e DATA_DIR="/data"`)。 +如果你使用的是本项目提供的 `docker-compose.yml`,你可以执行下面的命令。 ```shell docker run --rm -it \ @@ -144,6 +148,22 @@ docker run --rm -it \ [OPTIONS] ``` +如果你使用的是“自动备份”,请确认 vaultwarden 卷的命名,并替换 `--mount` `source` 部分。 + +同时不要忘记使用环境变量 `DATA_DIR` 指定数据目录(`-e DATA_DIR="/data"`)。 + +```shell +docker run --rm -it \ + \ # 如果你将本地目录映射到 Docker 容器中,就像 `vw-data` 一样 + --mount type=bind,source="本地目录的绝对路径",target=/data/ \ + \ # 如果你使用 Docker 卷 + --mount type=volume,source="Docker 卷名称",target=/data/ \ + --mount type=bind,source=$(pwd),target=/bitwarden/restore/ \ + -e DATA_DIR="/data" \ + ttionya/vaultwarden-backup:latest restore \ + [OPTIONS] +``` + 选项已在下面列出。 #### 选项