Docker For Beginners: How to build your first container

A beginner's guide to understanding what Docker is and what it is not.

source: https://docker.com

What is this Docker?

The word “Docker” is something you may have heard in a technology discussion, book or even a blog somewhere. But what does it really mean you may ask. By the end of this post, My goal is that you have a solid understanding of what Docker is and can flow with the discussion when next you hear it.

source: https://opensource.com

What is a Docker Image

A Docker Image is a file consisting of several layers of functionality built-in required to execute code in a container.

Difference Between a Virtual Machine and a Container

From the above explanation of a container, if you have worked with virtual machines before, you may be tempted to compare both. However, they are not. Below we will see a clear indication of their differences

Installing Docker

Irrespective of whether you are running on Windows, Linux or OSX operating system, Docker has a distro for you.

>> docker info

>> docker — version

If you see information about your Docker version pop up in your terminal window or cmd, then you can proceed. Congratulations on getting Docker installed.

Creating your first Docker Container

Once you have Docker installed, we will create our first Docker container with a single line of command. Type the following in your terminal or cmd.

>> docker container run -d — name my-nginx-server -p 80:80 nginx

Worried about what the above command is doing? Don't be. See below.

Google Cloud Architect, Software Engineer & SRE 🕴

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