Minio Storage not Persistent in Docker

Root Cause

Data storage for the Minio container in docker is not persistent in the local server, after restarting the server or container, Minio data storage is lost.

Solution

In the docker configuration for Minio, the volume is adjusted to ~/minio/data on the storage server and /data on the storage container. The thing that causes data to be non-persistent is when the storage on the server is not appropriate or not in ~/minio/data. The following is an example of a correct Docker configuration for a Minio volume.

mkdir -p ~/minio/data

docker run \
   -p 9000:9000 \
   -p 9090:9090 \
   --name minio \
   -v ~/minio/data:/data \
   -e "MINIO_ROOT_USER=ROOTNAME" \
   -e "MINIO_ROOT_PASSWORD=CHANGEME123" \
   quay.io/minio/minio server /data --console-address ":9090"