K
K
Kirill Nesmeyanov2017-07-15 02:57:45
Amazon Web Services
Kirill Nesmeyanov, 2017-07-15 02:57:45

How to mount docker container s3 (AWS)?

TL;DR: The 3rd party container host is "blahblah", but you need to connect to it with "some.blahblah" as the name.
And now a little more:
Raised a container with s3 (minito), has the following configs:

minio:
        container_name: "minio"
        build: ./docker/minio
        volumes:
            - minio:/export
        ports:
            - "9000:9000"
        environment:
            - MINIO_ACCESS_KEY=access
            - MINIO_SECRET_KEY=secretkey

Those. nothing extraordinary. To connect from under the main client (application container), I use the following host: minio:9000 .
Everything is logical, everything resolves.
But if you use a bucket (it doesn't work without it) - the host is replaced by " bucket.minio:9000 " and of course it won't resolve.
You can fix it hardcoded in the parent container (in the one who accesses s3) via:
extra_hosts:
    - "bucket.minio:172.25.0.4"

In this case, when accessing bucket.minio, the request will go to the desired IP address (under favorable circumstances, when it is really 172.25.0.4) and everything is ok. But this is a super crutch, which is pretty obvious.
Q: How can I normally connect to an s3 container (named minio) with "bucket.minio" as the host address? Or is it still some kind of nginx proxy?
The environment configs are as follows:
S3_HOST=http://minio:9000
S3_KEY=access
S3_SECRET=secret
S3_REGION=us-east-1
S3_BUCKET=bucket

AWS driver from Flysystem (default for Laravel).
UPD1: Here is such an option in the Dockerfile, shaitanaman, does not plow, although it would seem ...
RUN getent hosts minio | awk '{ print $1 " bucket." $2 }' >> /etc/hosts

// Original
$ ping minio
PING minio (172.26.0.4): 56 data bytes
64 bytes from 172.26.0.4: icmp_seq=0 ttl=64 time=0.065 ms
$ curl minio:9000
<?xml version="1.0" encoding="UTF-8"?>
<Error><Code>AccessDenied</Code><Message>Access Denied.</Message><Key></Key><BucketName></BucketName><Resource>/</Resource><RequestId>3L137</RequestId><HostId>3L137</HostId></Error>

// Alias
$ ping bucket.minio
PING bucket.minio (172.25.0.4): 56 data bytes
...
36 packets transmitted, 0 packets received, 100% packet loss
$ curl bucket.minio:9000
...
Вообще вешается

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
Kirill Nesmeyanov, 2017-07-15
@SerafimArts

Cheat code:

minio:
    container_name: "bucket.minio" <---
    build: ./docker/minio
   ...

And everything worked. But it's somehow .... Hmm, well, who knows...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question