Create your own hello-world image in Docker

Hi everyone, this is a short and first tutorial on how we can create images for our application in a docker.

I made a repo on Github, I’ll upload all images on this repo, you can check it from here


  • Introduction
  • Write Dockerfile
  • Build the image
  • Run the image
  • Conclusion


Docker has changed the way we build, package, and deploy applications. But this concept of packaging apps in containers isn’t new — it was in existence long before Docker.

Docker just made container technology easy for people to use. This is why Docker is a must-have in most development workflows today. Most likely, your dream company is using Docker right now.

Docker’s official documentation has a lot of moving parts. Honestly, it can be overwhelming at first. You could find yourself needing to glean information here and there to build that Docker image you’ve always wanted to build.

So that’s why I decided to make a series of articles on how to build images in docker for our applications, this is the first tutorial and I know for some people it’s so easy but we’ll do a lot of advanced images later.

Write docker file

Docker builds images automatically by reading the instructions from a Dockerfile. It is a text file that contains all commands needed to build a given image. In this example, we will build and run the Hello-world image.

firstly, create a dir with any name you want then create a file called Dockerfile without any extension, please note you should write the file as I wrote the D character should be uppercase, then copy the following code in your file.

Let’s break that code down.

  • From alpine is a minimal Docker image based on Alpine Linux with a complete package index and only 5 MB in size.
  • CMD: to execute the command once you run the docker container.

Build the image

Now that you have created a Dockerfile, it’s time to build your image using the docker build command.

docker build -t helloworld-custom .
  • t/ — tag gives a tag for your image

Run the image

now we built our image so let’s test it by running it.


We’ll run the image by tag that we specified in the previous command helloworld-custom.

docker container run helloworld-custom


Docker is a powerful platform for building, managing, and running containerized applications. In this Docker tutorial, we learned how to build our own image, it’ll be other tutorials learn you how to dockerize your application that works with different technologies (nodeJs - Angular - Laravel - etc..).

And that brings us to the end! Thank you so much for reading through this — if this article was helpful in any sense I’d really appreciate a follow to help me reach my 100-follower goal by the end of May 🙂.




Software engineer, Problem solver, Geek.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Enabling Federation to AWS Using Windows Active Directory, ADFS, and SAML 2.0 With Amazon Connect

C++ documentation with Doxygen/CMake/Sphinx/Breathe for those of use who are totally lost — Part 3

How I Got Into CAD/BIM

Search GitHub instead of Stackoverflow when in trouble

Deeper Network Monthly Newsletter:2022/5/1–2022/5/31

Python — Notes

Caching Miniconda Packages to Speed up Bitbucket Pipelines

Testing your Software Architecture

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store


Software engineer, Problem solver, Geek.

More from Medium

How to setup HTTP server with security headers using Nginx docker

Getting started with docker

Setup a LEMP Stack on Ubuntu 22.04

Using containers for your project

Simple docker architecture