如何在docker-compose + nginx反向代理上运行minio?

如何在docker-compose + nginx反向代理上运行minio?

我在使用 minio 时遇到了问题,无法在选定的域上启动 - 502 错误。

  • 我的 docker-compose.yml 用于 nginx 代理反向 + le
services:
    nginx:
        container_name: nginx
        image: nginxproxy/nginx-proxy
        restart: unless-stopped
        ports:
            - 80:80
            - 443:443
        volumes:
            - /var/run/docker.sock:/tmp/docker.sock:ro
            - /var/docker/nginx/html:/usr/share/nginx/html
            - /var/docker/nginx/certs:/etc/nginx/certs
            - /var/docker/nginx/vhost:/etc/nginx/vhost.d
        logging:
            options:
                max-size: "10m"
                max-file: "3"

    letsencrypt-companion:
        container_name: nginx-le
        image: jrcs/letsencrypt-nginx-proxy-companion
        restart: unless-stopped
        volumes_from:
            - nginx
        volumes:
            - /var/run/docker.sock:/var/run/docker.sock
            - /var/docker/nginx/acme:/etc/acme.sh
        environment:
            DEFAULT_EMAIL: [email protected]
  • minio 的 docker-compose.yml
version: '2'

services:
  minio:
    container_name: minio.domain.com
    command: server /data --console-address ":9001"
    environment:
      - MINIO_ROOT_USER=admin
      - MINIO_ROOT_PASSWORD=supersecret
      - MINIO_BROWSER_REDIRECT_URL=https://minio.domain.com
      - MINIO_DOMAIN=minio.domain.com
    image: quay.io/minio/minio:latest
    volumes:
      - minio:/data
    restart: unless-stopped
    expose:
      - "9000"
      - "9001"
    environment:
      VIRTUAL_HOST: minio.domain.com
      LETSENCRYPT_HOST:  minio.domain.com
    networks:
      - proxy

networks:
  proxy:
    external:
      name: nginx_default

volumes:
 minio:
  • minio 容器的 docker logs 日志
Warning: Default parity set to 0. This can lead to data loss.
WARNING: Detected default credentials 'minioadmin:minioadmin', we recommend that you change these values with 'MINIO_ROOT_USER' and 'MINIO_ROOT_PASSWORD' environment variables
MinIO Object Storage Server
Copyright: 2015-2022 MinIO, Inc.
License: GNU AGPLv3 <https://www.gnu.org/licenses/agpl-3.0.html>
Version: RELEASE.2022-12-12T19-27-27Z (go1.19.4 linux/amd64)

Status:         1 Online, 0 Offline.
API: http://192.168.0.7:9000  http://127.0.0.1:9000
Console: http://192.168.0.7:9001 http://127.0.0.1:9001

Documentation: https://min.io/docs/minio/linux/index.html

当我为 minio 输入 docker-compose 时:

   ports:
      - '9000:9000'
      - '9001:9001'

Minio 可以工作,但适用于我服务器上的所有域。如何修复 minio 只在 minio.domain.com 上显示的问题?

相关内容