[bitnami/minio] Update minio-env.sh to allow custom path for persist (#55562)

[bitnami/minio] Update minio-env.sh to allow custom path for persistence directory and updated README.md

Signed-off-by: Will Moorby <will.moorby2@gmail.com>
This commit is contained in:
Will Moorby
2024-02-07 11:24:57 +00:00
committed by GitHub
parent 06fca3c565
commit 27e3e40dbb
2 changed files with 30 additions and 5 deletions

View File

@@ -39,6 +39,7 @@ minio_env_vars=(
MINIO_FORCE_NEW_KEYS
MINIO_ROOT_USER
MINIO_ROOT_PASSWORD
MINIO_DATA_DIR
)
for env_var in "${minio_env_vars[@]}"; do
file_env_var="${env_var}_FILE"
@@ -60,7 +61,7 @@ export MINIO_CERTS_DIR="/certs"
export MINIO_LOGS_DIR="${MINIO_BASE_DIR}/log"
export MINIO_TMP_DIR="${MINIO_BASE_DIR}/tmp"
export MINIO_SECRETS_DIR="${MINIO_BASE_DIR}/secrets"
export MINIO_DATA_DIR="/bitnami/minio/data"
export MINIO_DATA_DIR="${MINIO_DATA_DIR:-/bitnami/minio/data}"
export MINIO_LOG_FILE="${MINIO_LOGS_DIR}/minio.log"
export MINIO_PID_FILE="${MINIO_TMP_DIR}/minio.pid"
export PATH="${MINIO_BIN_DIR}:${PATH}"

View File

@@ -68,7 +68,7 @@ docker build -t bitnami/APP:latest .
If you remove the container all your data will be lost, and the next time you run the image the database will be reinitialized. To avoid this loss of data, you should mount a volume that will persist even after the container is removed.
For persistence you should mount a directory at the `/bitnami/minio/data` path.
For persistence you can mount a directory at the `/bitnami/minio/data` path by default.
```console
docker run --name minio \
@@ -89,6 +89,31 @@ services:
...
```
You can also mount a volume to a custom path inside the container, provided that you run the container using the `MINIO_DATA_DIR` environment variable.
```console
docker run --name minio \
--publish 9000:9000 \
--publish 9001:9001 \
--volume /path/to/minio-persistence:/custom/path/within/container \
--env MINIO_DATA_DIR=/custom/path/within/container \
bitnami/minio:latest
```
or by modifying the [`docker-compose.yml`](https://github.com/bitnami/containers/blob/main/bitnami/minio/docker-compose.yml) file present in this repository:
```yaml
services:
minio:
...
volumes:
- /path/to/minio-persistence:/custom/path/within/container
...
environment:
- MINIO_DATA_DIR=/custom/path/within/container
...
```
> NOTE: As this is a non-root container, the mounted files and directories must have the proper permissions for the UID `1001`.
## Connecting to other containers
@@ -199,6 +224,7 @@ docker-compose up -d
| `MINIO_FORCE_NEW_KEYS` | Force recreating MinIO keys. | `no` |
| `MINIO_ROOT_USER` | MinIO root user name. | `minio` |
| `MINIO_ROOT_PASSWORD` | Password for MinIO root user. | `miniosecret` |
| `MINIO_DATA_DIR` | Directory that stores MinIO object data | `/bitnami/minio/data` |
#### Read-only environment variables
@@ -210,14 +236,12 @@ docker-compose up -d
| `MINIO_LOGS_DIR` | MinIO directory for log files. | `${MINIO_BASE_DIR}/log` |
| `MINIO_TMP_DIR` | MinIO directory for log files. | `${MINIO_BASE_DIR}/tmp` |
| `MINIO_SECRETS_DIR` | MinIO directory for credentials. | `${MINIO_BASE_DIR}/secrets` |
| `MINIO_DATA_DIR` | MinIO directory for data. | `/bitnami/minio/data` |
| `MINIO_DATA_DIR` | MinIO directory for data. | `/bitnami/minio/data` |
| `MINIO_LOG_FILE` | MinIO log file. | `${MINIO_LOGS_DIR}/minio.log` |
| `MINIO_PID_FILE` | MinIO PID file. | `${MINIO_TMP_DIR}/minio.pid` |
| `MINIO_DAEMON_USER` | MinIO system user. | `minio` |
| `MINIO_DAEMON_GROUP` | MinIO system group. | `minio` |
Additionally, MiNIO can be configured via environment variables as detailed at [MinIO(R) documentation](https://docs.min.io/docs/minio-server-configuration-guide.html).
Additionally, MinIO can be configured via environment variables as detailed at [MinIO(R) documentation](https://docs.min.io/docs/minio-server-configuration-guide.html).
A MinIO(R) Client (`mc`) is also shipped on this image that can be used to perform administrative tasks as described at the [MinIO(R) Client documentation](https://docs.min.io/docs/minio-admin-complete-guide.html). In the example below, the client is used to obtain the server info: