vsouza / docker-SQS-local

Docker image to run Amazon Simple Queue Service (Amazon SQS) locally.
MIT License
226 stars 32 forks source link

Queue urls use "localhost" rather than the endpoint used to create them #3

Closed biggianteye closed 6 years ago

biggianteye commented 6 years ago

When I create a queue, the resulting queue url contains the hostname localhost rather than the one from the endpoint being used.

Example:

$ aws --endpoint http://foo.bar.com:9324 sqs create-queue --queue-name foo
{
    "QueueUrl": "http://localhost:9324/queue/foo"
}

I would expect the queue url to be "http://foo.bar.com:9324/queue/foo". The localhost-based url is not usable outside the container. This behaviour means that this docker image can't be used as a drop in replacement for the live SQS services which returns usable urls.

AWS example:

$ aws sqs create-queue --queue-name foo
{
    "QueueUrl": "https://queue.amazonaws.com/<customer-id>/foo"
}

I am using a library to abstract away the actual details of communication with AWS and so don't have the ability to do any kind of manipulation on the queue urls being used.

Do you have any suggestions on what I could do to work around or fix this problem?

biggianteye commented 6 years ago

Looks like this is fixed by https://github.com/vsouza/docker-SQS-local/commit/3608b19ba3921751307cd12eae0980425f985a14 but the image on docker hub has not been updated. Could you please push the latest version to it?

Alternatively you can set it up to automatically build every time you commit to the repo, so you don't have to carry out this manual step:

https://docs.docker.com/docker-hub/builds/

biggianteye commented 6 years ago

I worked around the issue by volume mounting the custom.conf file and overriding the entrypoint to make use of this file. Here is my docker-compose.yml entry. Hopefully it will help someone else encountering this problem.

    sqs:
        image: vsouza/sqs-local
        ports:
            - 9324:9324
        volumes:
            - ./config/sqs-custom.conf:/custom.conf
        entrypoint: ["/usr/bin/java", "-Dconfig.file=custom.conf", "-jar", "/elasticmq-server-0.9.3.jar"]
vsouza commented 6 years ago

@biggianteye sorry for delay. I've updated image on dockerhub. Thanks for contribution :)