DOCKER HOME LAB | Using Finding Sharing Docker containers

In the previous post we saw how to create our own containers images. In this post I will show you how to share them with the world which also makes it convenient for you to access them from other host.


DOCKER HOME LAB | Where to Start ?

DOCKER HOME LAB | Managing Docker Containers

DOCKER HOME LAB | Commit changes to a container

DOCKER HOME LAB | Using / Finding / Sharing in Docker Public index

DOCKER HOME LAB | Building Containers with Dockerfile

DOCKER HOME LAB | Affect container with Dockerfile

This are the new commands we will be using in this post:

docker images

docker login

docker push

docker pull

docker rmi

Docker Registries are a services to store Docker images in a way that is layer aware and efficient

There is a free pubic registry run by the company behind Docker called the Docker hub. We can upload, download images from this index as an easy way to move containers of our own

Docker website

We need to register an account in the Docker website before we can upload anything to the hub. Visit and click on the signup link and login.

Docker Website Login

Now we can authenticate on the command line with docker login and provide the credentials you just setup

docker login command line

Remember we can run docker images command to see what images we have on this host. We previously made an sshd container image named galvezjavier/sshd

docker image

So let’s put that online

For our example, my image is named galvezjavier/sshd , which it begging with my docker user name and this is the convention you need to follow to push images to the docker index

Now we can push the image using the command docker push

docker push

As you can see is only uploading layers that it doesn’t know about, since we build it with an Ubuntu image from this repository, is not uploading any of that, just the changes we made.

Now if we visit the Docker index website, we can see the uploaded container image.

Docker Hub

We should test this image to make sure it works. First we will have to delete the image from our own host

We can do this with docker rmi command, not to be confuse with docker rm command, this new command is for removing images. Make sure you don’t have any container running with this image first

docker rmi

Now let’s pull this image from the index

Normally we don’t need to run docker pull, because if we try to run a container from an image that is in our host,  it will automatically pull the image from the index, however it can be useful to do this step upfront

docker pull galvezjavier/sshd

Now we have our image back from the index. Let’s test it.

We still have to specify which port we want to use to reach the internal port 22, but you can see we don’t need to specify the command since we configured it with the default

docker run

The image works fine. We can pull the image and run it again.  Now the image is public and anybody else can use it!

There are other ways to move container of your own if you don’t want them to make it public, but we will save that for another post.

Docker index: Find and use third-party containers.

Now let’s see how we can use the Docker index to find and use third-party containers.

Part of the beauty of Docker is that it make shipping of software very easy

A Docker container has all it all system dependencies inside it , and you run it on any host system with Docker , this make it ideal for sharing preconfigured open source software

I will walkthrough finding and using existing dockerized software, and in this case we will use a redis database

We want a redis container to run, so where do we start?

Actually there is a docker search command that will search against the public index

docker search

However I find this is not a great tool to find something new to start with if I picked any of the search results. I would know how to use them because there is no docs. That’s why I always start with the Docker help website

Docker Hub Index search

Here we get what looks like similar if not the exact same results, but we can learn much more about them, unfortunately many of them have no descriptions or useful information, the ones that will however are marked as official, and these are images that will build automatically from the linked git hub repo and ensures that you can see the source of the container image which often also includes documentation

The first in the list is an official build, and we can see that have a good description and instructions

Official images example

Image with instructions

What’s more, is we can click on a link to the git hub repository!

git hub link from image

Now that we know what we want to pull from the hub, we can just pull it down.

instructions to pull image

docker pull redis

After some quick reading on the instructions,  it looks like the running container will run the redis command by default and listen on port 6379. So let’s run a container with that port open. We will also give it a friendly name of redis.

docker run --name jav-redis -d redis

Now let’s look on the logs to see if everything is fine

docker logs

It looks like we can use this container image to run the client, so we don’t even need to install a redis client to test our redis server

This command is using some advance docker run features including linking and entry point overwriting.

I will explore this in a future post.  For now just run it exactly as I do here

docker run –rm -i -t –entrypoint=”bash” –link jav-redis:redis redis -c ‘redis-cli –h $REDIS_PORT_6379_TCP_ADDR’

docke run | redis client

We are in a redis shell, we can set a value and get to see if is actually talking with a server

test and verification of redis container


Although you may need to do some digging it make sure you know what are you getting, finding dockerized open source software is quite fun. It is also valuable in seeing how others containerized various projects, which we will be doing in the next post. And this is it for now. Keep tuned@

Docker Home Lab

Docker Home Lab


  1. […] DOCKER HOME LAB | Using / Finding / Sharing in Docker Public index […]

  2. […] DOCKER HOME LAB | Using / Finding / Sharing in Docker Public index […]

  3. […] DOCKER HOME LAB | Using / Finding / Sharing in Docker Public index […]

Speak Your Mind


%d bloggers like this: