13

Below is a service in my docker compose.

  minio:
    image: minio/minio:edge
    environment:
      MINIO_ACCESS_KEY: minio123
      MINIO_SECRET_KEY: minio123
    volumes:
      - datastore:/data
    ports:
      - 9000:9000
    networks:
      - devnetwork
    command: server /data

i tried multiple commands like the following:

mc policy set public myminio/mybucket

always get the below error when i try access an image in my bucket

  <?xml version="1.0" encoding="UTF-8"?>
  <Error>
  <Code>AccessDenied</Code>
  <Message>Access Denied.</Message>
  <Key>images/281c1458-41cd-4e1e-b6d5-b7243b9ac650.jpg</Key>
  <BucketName>mybucket</BucketName>
  <Resource>/mybucket/images/281c1458-41cd-4e1e-b6d5-b7243b9ac650.jpg</Resource>
  <RequestId>1667FAC6085F2E6C</RequestId>
  <HostId>9159f2da-4de3-4300-91fe-d59a41d883c4</HostId>
  </Error>
mamadou jallow
  • 351
  • 1
  • 2
  • 10

2 Answers2

32

You can add mc to the docker-compose as seen here - https://github.com/minio/minio/issues/4769

Updating a bit for changes that have happened in the mc commands, it would look something like this:

version: "2"
services:
  minio:
    image: minio/minio
    ports:
      - "9000:9000"
    volumes:
      - datastore:/data
    environment:
      - "MINIO_ACCESS_KEY=minio"
      - "MINIO_SECRET_KEY=minio123"
    command: server /data

  createbuckets:
    image: minio/mc
    depends_on:
      - minio
    entrypoint: >
      /bin/sh -c "
      /usr/bin/mc alias set myminio http://minio:9000 minio minio123;
      /usr/bin/mc mb myminio/somebucketname;
      /usr/bin/mc policy set public myminio/somebucketname;
      exit 0;
      "
Eco
  • 589
  • 3
  • 3
  • 4
    Thanks for updating. Minio should really have this by now, its 1/2 their users - quick docker for testing. – Andrew May 13 '22 at 19:47
  • The `mc policy` commands have been replaced with `mc anonymous`, so the `set` command becomes `/usr/bin/mc anonymous set public myminio/somebucketname;`. See the [docs](https://min.io/docs/minio/linux/reference/minio-mc/mc-anonymous-set.html). – Chad von Nau Aug 13 '23 at 17:42
-2

I fixed the issue for me by just going to the minio web client image below: Minio Web client

Step 1:

Open the settings of you the bucket you want to make public enter image description here click on edit settings

Step 2:

Add a new policy. I DID NOT TYPE ANYTHING IN THE POLICY. i just selected Read and Write option in the dropdown. This results in a '*' policy with read and write permissions.

enter image description here

mamadou jallow
  • 351
  • 1
  • 2
  • 10