mirror of
https://github.com/minio/minio.git
synced 2024-12-23 21:55:53 -05:00
Add custom secret names for Docker (#5355)
This commit is contained in:
parent
7c72d14027
commit
bd9cdcf379
@ -6,6 +6,8 @@ ENV GOPATH /go
|
||||
ENV PATH $PATH:$GOPATH/bin
|
||||
ENV CGO_ENABLED 0
|
||||
ENV MINIO_UPDATE off
|
||||
ENV MINIO_ACCESS_KEY_FILE=access_key \
|
||||
MINIO_SECRET_KEY_FILE=secret_key
|
||||
|
||||
WORKDIR /go/src/github.com/minio/
|
||||
|
||||
|
@ -6,6 +6,8 @@ ENV GOPATH /go
|
||||
ENV PATH $PATH:$GOPATH/bin
|
||||
ENV CGO_ENABLED 0
|
||||
ENV MINIO_UPDATE off
|
||||
ENV MINIO_ACCESS_KEY_FILE=access_key \
|
||||
MINIO_SECRET_KEY_FILE=secret_key
|
||||
|
||||
WORKDIR /go/src/github.com/minio/
|
||||
|
||||
|
@ -5,6 +5,8 @@ MAINTAINER Minio Inc <dev@minio.io>
|
||||
COPY dockerscripts/docker-entrypoint.sh dockerscripts/healthcheck.sh /usr/bin/
|
||||
|
||||
ENV MINIO_UPDATE off
|
||||
ENV MINIO_ACCESS_KEY_FILE=access_key \
|
||||
MINIO_SECRET_KEY_FILE=secret_key
|
||||
|
||||
RUN \
|
||||
apk add --no-cache ca-certificates && \
|
||||
|
@ -24,15 +24,15 @@ fi
|
||||
|
||||
## Look for docker secrets in default documented location.
|
||||
docker_secrets_env() {
|
||||
local MINIO_ACCESS_KEY_FILE="/run/secrets/access_key"
|
||||
local MINIO_SECRET_KEY_FILE="/run/secrets/secret_key"
|
||||
local ACCESS_KEY_FILE="/run/secrets/$MINIO_ACCESS_KEY_FILE"
|
||||
local SECRET_KEY_FILE="/run/secrets/$MINIO_SECRET_KEY_FILE"
|
||||
|
||||
if [ -f $MINIO_ACCESS_KEY_FILE -a -f $MINIO_SECRET_KEY_FILE ]; then
|
||||
if [ -f $MINIO_ACCESS_KEY_FILE ]; then
|
||||
export MINIO_ACCESS_KEY="$(cat "$MINIO_ACCESS_KEY_FILE")"
|
||||
if [ -f $ACCESS_KEY_FILE -a -f $SECRET_KEY_FILE ]; then
|
||||
if [ -f $ACCESS_KEY_FILE ]; then
|
||||
export MINIO_ACCESS_KEY="$(cat "$ACCESS_KEY_FILE")"
|
||||
fi
|
||||
if [ -f $MINIO_SECRET_KEY_FILE ]; then
|
||||
export MINIO_SECRET_KEY="$(cat "$MINIO_SECRET_KEY_FILE")"
|
||||
if [ -f $SECRET_KEY_FILE ]; then
|
||||
export MINIO_SECRET_KEY="$(cat "$SECRET_KEY_FILE")"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
@ -73,6 +73,17 @@ docker service create --name="minio-service" --secret="access_key" --secret="sec
|
||||
|
||||
Read more about `docker service` [here](https://docs.docker.com/engine/swarm/how-swarm-mode-works/services/)
|
||||
|
||||
#### Minio Custom Access and Secret Key files
|
||||
To use other secret names follow the instuctions above and replace `access_key` and `secret_key` with your custom names (e.g. `my_secret_key`,`my_custom_key`). Run your service with
|
||||
```
|
||||
docker service create --name="minio-service" \
|
||||
--secret="my_access_key" \
|
||||
--secret="my_secret_key" \
|
||||
--env="MINIO_ACCESS_KEY_FILE=my_access_key" \
|
||||
--env="MINIO_SECRET_KEY_FILE=my_secret_key" \
|
||||
minio/minio server /data
|
||||
```
|
||||
|
||||
### Retrieving Container ID
|
||||
To use Docker commands on a specific container, you need to know the `Container ID` for that container. To get the `Container ID`, run
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user