I am using AWS SQS in my project. I want to use this for local setup. For SQS purpose I have added dokcer_local on my project.
I have updated docker file with by adding this as suggested in the link.
FROM java:8
ADD https://s3-eu-west-1.amazonaws.com/softwaremill-public/elasticmq-server-0.13.8.jar /
COPY custom.conf /
ENTRYPOINT ["/usr/bin/java", "-Dconfig.file=custom.conf", "-jar", "/elasticmq-server-0.13.8.jar"]
EXPOSE 9324
CMD ["-help"]
When I execute command docker ps
I get this on my screen
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
48e934fc6c43 mysql:5.7.16 "docker-entrypoint.s…" 24 minutes ago Up 24 minutes 0.0.0.0:10612->3306/tcp xyz_mysql_1
0af050bd3332 vsouza/sqs-local "/usr/bin/java -Dcon…" 2 hours ago Up 2 hours 0.0.0.0:9324->9324/tcp wizardly_yalow
I have added entry for sqs in my docker-compose.yml file too as:
sqs:
image: s12v/elasticmq
ports:
- "9324:9324".
Now I am unable to understand how to use the sqs on my console.
after going in the shell of sqs using this command sudo docker exec -it 0af050bd3332 sh
. When I try to list queue it is printing sh: 2: list-queues: not found
error.
I have tried lots of things but nothing seems to work.
We need to pull down the SQL Server docker image from the container registry with the following command: 2. Run the container Now that we have the sql server image locally, it’s time to run the container. SQL Server needs us to set 2 environment variables, first to Accept the EULA agreement, and secondly to set the SA password.
Now that Docker is running on your PC, you need to startup PowerShell as an Administrator. Then you can paste the following command into PowerShell to get LocalStack SQS running (this is all one line): The first time you run this command, Docker will download the LocalStack software from the repository.
In this post I’m going to show how to get Amazon’s SQS queue working locally using LocalStack for Docker. The first step is to download and install Docker. If you don’t have Docker installed on your Windows PC, you’ll need to search for the docker download. Look for “docker engine community for windows” to find the right one.
.... This should be all to at least see the queue create inside your Fake-SQS running inside your docker container which is running on http://localhost:9324. Here is the list of API calls that you can make for this queue.
What your Dockerfile is doing is creating an ElasticMQ server. The latter is a "message queue system" which is compatible with SQS. So, you can use it the same exact way you use SQS, except you have to change the endpoint
parameter when using the AWS CLI or SDK.
Let's do an interactive example here:
$ docker run -p 9324:9324 -p 9325:9325 softwaremill/elasticmq
--endpoint
parameter pointing to the locally running ElasticMQ server created above):$ aws --region=us-west-2 --endpoint=http://localhost:9324 sqs list-queues
The result should be empty.
$ aws --region=us-west-2 --endpoint=http://localhost:9324 sqs create-queue --queue-name=test
{
"QueueUrl": "http://localhost:9324/000000000000/test"
}
list-queues
again and notice that you have a new queue:$ aws --region=us-west-2 --endpoint=http://localhost:9324 sqs list-queues
{
"QueueUrls": [
"http://localhost:9324/000000000000/test"
]
}
Hope this helps!
Rafid
In our porject we run Localstack in docker. It has all AWS services available.
Very easy to use, here is an example docker compose file
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With