Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docker: Create bucket and set global policy #5184

Closed
tillkruss opened this issue Nov 14, 2017 · 10 comments
Closed

Docker: Create bucket and set global policy #5184

tillkruss opened this issue Nov 14, 2017 · 10 comments

Comments

@tillkruss
Copy link

I'm not sure if this is the right place to ask questions, I'm sorry if it isn't.

I would like to create a bucket and set a global policy (for all future uploaded files) when the Minio docker container is build. Is that possible?

This is my Minio setup in my docker-compose.yml:

minio:
  image: minio/minio
  volumes:
    - minio:/data
  ports:
    - "9001:9000"
  environment:
    - MINIO_ACCESS_KEY=minio
    - MINIO_SECRET_KEY=password
  command: server /data
@harshavardhana
Copy link
Member

https://gist.github.com/harshavardhana/cb6c0d4d220a9334a66d6259c7d54c95 take look how it can be achieved here.. @tillkruss

@tillkruss
Copy link
Author

@harshavardhana: Thanks!

So I would just run this?

entrypoint: >
  /bin/sh -c "
  /usr/bin/mc mb acme;
  /usr/bin/mc policy public acme;
  "

@harshavardhana
Copy link
Member

You need to configure mc properly first with an alias @tillkruss https://docs.minio.io/docs/minio-client-quickstart-guide can help you.

@nitisht nitisht added this to the Next Release milestone Nov 15, 2017
@rphovley
Copy link

rphovley commented Nov 16, 2017

I'm a little confused of trying to run /usr/bin/mc mb acme; since there is no minio client installed in the docker container by default.

You'll end up getting the output /bin/sh: /usr/bin/mc: not found since mc isn't in that directory.

I know you could potentially alias to only need to run mc by itself, but it appears that mc isn't even on the image. minio is, but that is only used to run the server. I see that there's a minio client image https://hub.docker.com/r/minio/mc/. Do I have to run that service as well apart of the network and have it create the initial bucket? It seems like a heavy way to just create the bucket once for the lifetime of the container.

EDIT: I realized that the link https://gist.github.com/harshavardhana/cb6c0d4d220a9334a66d6259c7d54c95 in fact does use the mc image to perform this action. It still feels heavy to have a container dedicated for a single task that will be run once but it's worth it for us at the moment.

@harshavardhana
Copy link
Member

You can alternatively download the mc as well.

@harshavardhana
Copy link
Member

It seems like a heavy way to just create the bucket once for the lifetime of the container.

Also I don't think its heavy, its an alpine Linux container which is 5MiB compressed.

@rphovley
Copy link

I thought the container remained running but since it only stays online as long as it's needed makes me feel better about it :)

@harshavardhana
Copy link
Member

Closing this as answered feel free to open new issues if you have further questions @tillkruss

@tillkruss
Copy link
Author

No, thanks. I got it working.

I ended up installing mc inside my workspace container and execute the commands manually.

Having an entire container just for mc seemed unessesary.

@lock
Copy link

lock bot commented Apr 26, 2020

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.

@lock lock bot locked as resolved and limited conversation to collaborators Apr 26, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants