Minio: Can't mount host data directory to minio server docker container

Created on 3 Aug 2018  路  5Comments  路  Source: minio/minio

Expected Behavior

Add the option -v /mnt/data:/data to the docker run command to have minio saving data to host directory.

Current Behavior

Minio cannot write to data directory because of permission error.

Created minio configuration file successfully at /root/.minio                                                                                                                                                 
ERROR Unable to initialize backend: Unable to write to the backend.                                                                                                                                           
      > Please ensure Minio binary has write permissions for the backend.

Possible Solution

I am probably doing something stupid; solution is to point out the obvious thing I'm missing.

Steps to Reproduce (for bugs)

Starting with the simplest case.
Create folder on host where data will reside:

sudo su
mkdir /mnt/data
chmod -R 777 /mnt/data

Run a new docker container:

docker run -p 9000:9000 --name minio1 \
  -v /mnt/data:/data \
  minio/minio server /data

Result:

Created minio configuration file successfully at /root/.minio                                                                                                                                                 
ERROR Unable to initialize backend: Unable to write to the backend.                                                                                                                                           
      > Please ensure Minio binary has write permissions for the backend.

Context

I just want to move from the super-toy example of spinning up a minio docker container to the somewhat toy example of binding the minio /data directory to the host /mnt/data directory.

Your Environment

  • Version used : minio/minio:latest docker image
  • Docker host: centos-atomic-host 7.1805

Most helpful comment

For Project Atomic you can also set append :z or :Z to the have SElinux allow writing to the container:

docker run -p 9000:9000 --name minio1 \
-v /mnt/data:/data:z \
minio/minio server /data

More info at:
https://www.projectatomic.io/blog/2016/03/dwalsh_selinux_containers/

All 5 comments

It was a silly issue; posting solution for posterity. Key issue was this:

Docker host: centos-atomic-host 7.1805

Atomic host runs SELinux by default. Turning off SELinux resolves the issue.

Atomic host runs SELinux by default. Turning off SELinux resolves the issue.

Do you have any docs which allow us to provide SELinux make this work?

For Project Atomic you can also set append :z or :Z to the have SElinux allow writing to the container:

docker run -p 9000:9000 --name minio1 \
-v /mnt/data:/data:z \
minio/minio server /data

More info at:
https://www.projectatomic.io/blog/2016/03/dwalsh_selinux_containers/

@eco-minio command works. Thanks!

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

iamso picture iamso  路  4Comments

theredcat picture theredcat  路  3Comments

Alexander-He picture Alexander-He  路  5Comments

akuktin picture akuktin  路  4Comments

Ostico picture Ostico  路  5Comments