最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

laravel - Docker DNS issue with minio - Stack Overflow

programmeradmin1浏览0评论

recently i have moved my storage to a s3 storage and i want to host minio locally so i can work with that, i have added the minio in the docker-compose file with this configuration

    minio:
        image: minio/minio:latest
        container_name: minio
        ports:
            - "9003:9000"
            - "9004:9001"
        environment:
            MINIO_ROOT_USER: minioadmin
            MINIO_ROOT_PASSWORD: minioadmin
        command: server /data --console-address ":9001"
        networks:
            - laravel
        volumes:
            - minio:/data

and i have setup the configurations needed to connect to minio in my laravel app:

FILESYSTEM_DRIVER=s3
AWS_ENDPOINT=http://minio:9000
AWS_ACCESS_KEY_ID=minioadmin
AWS_SECRET_ACCESS_KEY=minioadmin
AWS_DEFAULT_REGION=us-east-1
AWS_BUCKET=bucket
AWS_USE_PATH_STYLE_ENDPOINT=true

but i can't connect to minio in my app

i have tried multiple configurations but nothing changes, finally i did a test in the php container where the app is running and i found out this:

/var/www/html $ ping minio
PING minio (172.18.0.3): 56 data bytes
64 bytes from 172.18.0.3: seq=0 ttl=42 time=0.142 ms
64 bytes from 172.18.0.3: seq=1 ttl=42 time=0.054 ms
64 bytes from 172.18.0.3: seq=2 ttl=42 time=0.119 ms
64 bytes from 172.18.0.3: seq=3 ttl=42 time=0.086 ms
64 bytes from 172.18.0.3: seq=4 ttl=42 time=0.090 ms
64 bytes from 172.18.0.3: seq=5 ttl=42 time=0.198 ms
64 bytes from 172.18.0.3: seq=6 ttl=42 time=0.108 ms
64 bytes from 172.18.0.3: seq=7 ttl=42 time=0.104 ms
64 bytes from 172.18.0.3: seq=8 ttl=42 time=0.109 ms
64 bytes from 172.18.0.3: seq=9 ttl=42 time=0.096 ms
64 bytes from 172.18.0.3: seq=10 ttl=42 time=0.088 ms
64 bytes from 172.18.0.3: seq=11 ttl=42 time=0.139 ms
64 bytes from 172.18.0.3: seq=12 ttl=42 time=0.097 ms
64 bytes from 172.18.0.3: seq=13 ttl=42 time=0.091 ms
64 bytes from 172.18.0.3: seq=14 ttl=42 time=0.059 ms
64 bytes from 172.18.0.3: seq=15 ttl=42 time=0.130 ms
^C
--- minio ping statistics ---
16 packets transmitted, 16 packets received, 0% packet loss
round-trip min/avg/max = 0.054/0.106/0.198 ms
/var/www/html $ curl http://minio:9000 -v
* Host minio:9000 was resolved.
* IPv6: (none)
* IPv4: 1.1.1.1
*   Trying 1.1.1.1:9000...
* Connected to minio (1.1.1.1) port 9000
> GET / HTTP/1.1
> Host: minio:9000
> User-Agent: curl/8.9.1
> Accept: */*
> 
* Request completely sent off

as you can see here when i ping minio i get the container ip, and if i set the ip in my app's configurations everything works fine, but the odd thing is that when i connect to it using curl it tries 1.1.1.1 instead of the designated ip for minio container.

i don't know what might cause the issue, because i have tried this in two other laravel projects, one of them works fine and the other one have the same issue

发布评论

评论列表(0)

  1. 暂无评论