Minio允许拒绝

发布于 2025-01-30 19:38:48 字数 636 浏览 3 评论 0原文

当我启动Docker容器时,我对Minio有问题,这是我的错误:

19:32:16.16 info ==> **启动Minio设置**

/opt/bitnami/scripts/libminio.sh:line 324:/data/.root_user:

在Windows上拒绝它的许可,但在Linux上否认

这是我的Docker-Composesings:

        container_name: minio
        image: "bitnami/minio:latest"
        ports:
            - "9000:9000"
            - "9001:9001"
        environment:
            - MINIO_ACCESS_KEY=${ACCESS_KEY}
            - MINIO_SECRET_KEY=${SECRET_KEY}
            - MINIO_DEFAULT_BUCKETS=${BUCKET}
        volumes:
            - ./docker-volumes/s3-data:/data
        networks:
            - proxy

When I start my docker container, I have a problem with minio this is my error:

19:32:16.16 INFO ==> ** Starting MinIO setup **

/opt/bitnami/scripts/libminio.sh: line 324: /data/.root_user: Permission denied

On windows it works but on linux not

this is my docker-compose settings:

        container_name: minio
        image: "bitnami/minio:latest"
        ports:
            - "9000:9000"
            - "9001:9001"
        environment:
            - MINIO_ACCESS_KEY=${ACCESS_KEY}
            - MINIO_SECRET_KEY=${SECRET_KEY}
            - MINIO_DEFAULT_BUCKETS=${BUCKET}
        volumes:
            - ./docker-volumes/s3-data:/data
        networks:
            - proxy

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

流殇 2025-02-06 19:38:48

您的问题

是将目录./ docker-volumes/s3-data绑定到容器中的问题。最初,此目录不存在,因此Docker将其创建为根。这意味着容器内部的/data目录由root拥有。

不幸的是,容器Minio在用户1001中运行,因此在/data 。

解决方案1:Docker卷

如果您使用命名的Docker卷,而不是绑定安装主机目录:

version: "3"

services:
  minio:
    container_name: minio
    image: "bitnami/minio:latest"
    ports:
        - "9000:9000"
        - "9001:9001"
    environment:
        - MINIO_ACCESS_KEY=${ACCESS_KEY}
        - MINIO_SECRET_KEY=${SECRET_KEY}
        - MINIO_DEFAULT_BUCKETS=${BUCKET}
    volumes:
        - minio_data:/data

volumes:
  minio_data:

然后,Docker将将卷的所有者和权限设置为您安装卷的目录的权限。在bitnami/minio图像中,/data看起来像:

[lars@docker work]$ docker run -it --rm  bitnami/minio:latest ls -ld /data
[...]
drwxrwxr-x. 2 root root 6 May 22 00:55 /data

它是用户root和group root 。 Minio容器作为UID 1001和组root运行,因此可以写入该目录。

futzing futzing futzing

解决方案2:当然,您可以明确提出docker-volumes/s3-data
目录然后将其chown到适当的userId:

sudo chown 1001 docker-volumes/s3-data

但是通常,除非有一个原因,否则您需要使用特定
主机目录,使用命名的Docker卷如解决方案1中
更易于管理(因为您不需要知道容器
提前用户ID,并且因为您最终不会使用由
您的主目录中的non-you UserIds)。

The problem

You are bind-mounting the directory ./docker-volumes/s3-data into the container. Initially this directory doesn't exist, so Docker creates it -- as root. This means that the /data directory inside the container is owned by root.

Unfortunately, inside the container minio is running as user 1001, so it doesn't have sufficient permissions to create files (or directories) inside /data.

Solution 1: Docker volumes

If instead of bind-mounting a host directory you use a named docker volume, like this:

version: "3"

services:
  minio:
    container_name: minio
    image: "bitnami/minio:latest"
    ports:
        - "9000:9000"
        - "9001:9001"
    environment:
        - MINIO_ACCESS_KEY=${ACCESS_KEY}
        - MINIO_SECRET_KEY=${SECRET_KEY}
        - MINIO_DEFAULT_BUCKETS=${BUCKET}
    volumes:
        - minio_data:/data

volumes:
  minio_data:

Then Docker will set the owner and permissions of the volume to the permissions of the directory on which you are mounting the volume. In the bitnami/minio image, /data looks like:

[lars@docker work]$ docker run -it --rm  bitnami/minio:latest ls -ld /data
[...]
drwxrwxr-x. 2 root root 6 May 22 00:55 /data

That is, it's writable by user root and group root. The minio container is running as UID 1001 and group root, so it's able to write to that directory.

Solution 2: Futzing with permissions

You can, of course, explicitly pre-create the docker-volumes/s3-data
directory and then chown it to the appropriate userid:

sudo chown 1001 docker-volumes/s3-data

But in general, unless there's a reason why you need to use a specific
host directory, using a named Docker volume as in solution 1 is going
to be more manageable (because you don't need to know the container
userid in advance, and because you won't end up with files owned by
non-you userids in your home directory ).

挽手叙旧 2025-02-06 19:38:48

我有一个Minikube的问题,因为我只需要它来测试目的,所以我添加了- set persistence.enabled =“ false”

完整命令是:

helm install minio bitnami/minio --namespace minio --create-namespace --set image.debug="true" --set service.type="ClusterIP" --set persistence.enabled="false"

I had this problem with a minikube, since I just needed it for testing purposes I added --set persistence.enabled="false"

The Full Command being:

helm install minio bitnami/minio --namespace minio --create-namespace --set image.debug="true" --set service.type="ClusterIP" --set persistence.enabled="false"
瀟灑尐姊 2025-02-06 19:38:48
sudo chown -R 1001:1001 docker-volumes/s3-data
sudo chown -R 1001:1001 docker-volumes/s3-data
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文