Could not connect to the endpoint URL: "http://localhost:4567/"


I’m trying to use a docker image to run locally an AWS Kinesis instance.
Some images used from Docker Hub are:



when I try to use a client, for example the list of streams with:


I receive the error:

botocore.exceptions.EndpointConnectionError: Could not connect to the endpoint URL: “http://localhost:4567/

The same problem happen with other similar images based on Kinesis.
I follow this tutorial:

Can someone help me?

Please provide context information about how you start your containers and specifically tell us which container throws the exception.

Note: localhost on the host and localhost for any container is not the same localhost. Also localhost is local to each container.

Hi meyay,

thank you for your question.
Some information as you requested: I’m working on a laptop based on 64 bit windows 10 pro.
My Docker version is Docker Desktop 4.12.0 (85629).
The command sequence from cmd window to reproduce my error is:

docker pull ruanbekker/kinesis-local
docker run -it python:3.7-alpine sh

pip3 install boto3
import boto3
client = boto3.Session(region_name=‘eu-west-1’).client(‘kinesis’, aws_access_key_id=‘’, aws_secret_access_key=‘’, endpoint_url=‘http://localhost:4567’)

the last command inside python container give the error…
I’m new on Docker…may it be the kinesis container is not connected with python container?
Thank you for your support.

I had a hunch that this would be an issue and wrote this because of that:

But what I couldn’t assume is that you only pull the kinesis image, but never run it. Plus what I quoted from my previous post: localhost is always local to the context you are in, regardless if it’s the host, or a container. It is not shared amongst the host and container or between containers.

If you want one container to access another container, both need to be added to a user defined network and use the container name to access the target container:

docker network create kinesis-net
docker run -d -p 4567:4567 --name kinesis-local --network="kinesis-net" ruanbekker/kinesis-local:latest
docker run -ti  --network="kinesis-net" python:3.7-alpine sh

Then change your client line to:

client = boto3.Session(region_name=‘eu-west-1’).client(‘kinesis’, aws_access_key_id=‘’, aws_secret_access_key=‘’, endpoint_url='http://kinesis-local:4567')

(note: this is just an illustration, do NOT copy and paste it in the console before fixing the single quotes, which are not valid single quotes).

May I suggest spending some time with this fabulous self-paced docker-training: Introduction to Containers

It should give you a solid understanding of docker concepts and how things are done in docker.