Nerdsense

DockerHub: Because Ship Happens

Greg Heffner July 17, 2024
Load Balancing

What it is

DockerHub can be looked at like a marketplace, but for application packages. We have talked before about GitHub and how it manages and stores your scripts and codes, or as explained in my previous blogs example the "Treasure Chest for Computer Spells" as Bing AI informed us. Think of DockerHub in the same kind of way but for application packages called Docker Images.

Docker images are like tiny computers but without all the extra stuff. When some people think of a windows or apple desktop computers they would think of the Operating System and how they would interface with it. Maybe you like the way the windows start menu looks, or you like the terminal in a mac. You have certain expectations or actions you are going to take on your computer and you have your preferences in how you do it. You dont really have to worry about what kind of processesor, memory, or disk you have. You expect all of those things to be working as effienciently as needed to do the job. Open computer, click the browser, goto Nerdsense blog and it just loads as expected.

VM vs Docker
Differences between a VM (left) and a Docker Image (Right). As you can see both stacks have the same data. Docker just allows you to present the data more compact and portable TechTarget example

Docker images are kinda the same. Docker images are packages of the "meat and potatoes" of the solution but without all the hardware baggage. You can run the same codes, click the same windows, perform the same duties. Docker images allows you the convienance of portability, package version control, and security. Lets say you want to build a Kali Linux machine to do some Virtual Capture the Flag exercises in TryHackMe EasyCTF room but all you have is your laptop with windows or mac running on it. Gone are the days of having to install a whole new Operating System and dual boot or buy a whole new computer in order to do this. Docker Images are application packages as I said before and some of these packages are whole Operating Systems!

If you would like to see a detailed video explaining docker further check it out here

If you are asking what is a CTF please check this youtube short where John Hammond, a successful Cybersecurity Researcher, explains.

Installing and Running an OS

The first step in pulling a docker image is installing docker.

The second step in pulling a docker image is finding a image you trust to pull. When you search dockerhub for docker images that people are either reccomending or have used before, please keep in mind that these images are made by other people and not everyone online is nice. Try to stay within Docker Official Images, Verified Publishers, or someone you trust. Try to stay away from running packages or programs from unknown sources or from strangers you met online. So anyways, here is a link to a Kali Image I made, you know a stranger on the internet. If you would prefer to download it directly you can use "docker pull technotuba/kali-full:v1" in the command line of your terminal. If you would prefer to use Official Kali images Look Here. I made my image off of the default Kali image but I update all the packages monthly so I dont have to do this step each time. I have my Docker images saved as v1 for a small package and v2 for the full package and all updates. Once you download the version you need, verify it is infact on your machine by running "docker images" from the command line of your terminal. You should see a list of docker images downloaded on your system and you should see one named technotuba/Kali* or kalilinux/kali* depending on if you downloaded my image or Kalis Official Image.

Now, to get to the command line of this Kali Docker image. Part of the benefit of running docker is the ability to have completly seperate environments. This can come in handy when wanting to run tests or updates that have no way of touching the host system. What if you wanted to test a patch or code change locally before making the change on customer facing devices? Spin up a docker image. If there are problems you just kill the docker image and nothing changed. Completely isolated.

There are quite a few ways you can interact with Docker images but in this writeup, we are going to use the Docker run command.

docker run -it --name Kali_Docker ba0735ee9b3f

This will rename and run the downloaded image from earlier.

  • docker run Runs a docker image you have previously downloaded. Remember to check for these with "docker images" command.
  • -it connect to STDIN which allows command input and to make an interactive terminal
  • --name Name the Docker Image something specific instead for future use and ease of recognition. I used "Kali_Docker" in this example
  • ba0735ee9b3f The IMAGE ID from the "docker images" command you ran earlier. It will be different for each image.
Running Kali Docker Image
A screen capture of the above commands

Thats it! Now you are at the command line of a Kali Operating System terminal running in a docker container!

DockerHub, much like GitHub, is a great place to store, share, and collabrate on projects and packages. There are some very interesting FREE solutions DockerHub provides you when you signup for an account. I personally like to use Docker Scout to scan my images for vulnerabilities and issues with my packages. In this blog I only gave examples for OS builds. OS builds are by far the least interesting solution people have made and stored in DockerHub. Please make sure you check out all the great solutions people have come up with.

Note: I use a NGINX docker image to build this website! Check out the docker image here and the GitHub writeup for it here

Bing AI...im getting the hint. Yall love this part

Docker Hub is like a magical treasure chest for computer programs called containers. Imagine these containers as tiny, self-contained boxes that hold everything a program needs to run, like ingredients for a recipe!

Heres how it works:

  • Finding Containers: Developers and creators visit Docker Hub to find ready-made containers. Its like going to a toy store to pick out cool toys!
  • Sharing Containers: People who make these containers can share them with others. Its like sharing your favorite toys with friends!
  • Example: Lets say you want to build a website. Instead of starting from scratch, you can find a pre-made container with all the website ingredients like the code, images, and settings. Just grab it from Docker Hub, and voila! Your website is ready to go!

    BingAI DockerHub Visual
    From Bing AI

About Me

I served in the U.S. Army, specializing in Network Switching Systems and was attached to a Patriot Missile System Battalion. After my deployment and Honorable discharge, I went to college in Jacksonville, FL for Computer Science. I have two beautiful and very intelligent daughters. I have more than 20 years professional IT experience. This page is made to learn and have fun. If its messed up, let me know. Im still learning :)

Weather Loop