Docker 101

Docker 101

Introduction to docker

What is Docker?

Docker as defined by it's official website, is an open platform for developing, shipping and running applications.

Basically what docker does is, it provides the ability to package and run an applicaition in a loosely isolated environment called containers.

So what is a container now? You might ask
A container is a standard unit of software that packages up code and all its dependencies so the application runs quickly and reliably from one computing environment to another.

The way you can view containers is that a big application is broken down into smaller components and run in an isolated environment.The application inside the container considers itself to be the only process running on the machine while the machine can run multiple containers independently.

Docker foundations

Step 1 : Running a container

The name of the image we want to run is known, then a docker run <options> <image-name> is entered into the terminal and boom!! we have our container running

Step 2 : Finding Running Containers

Now that we have launched a container we have to find the conatiner, this can be done using docker pson the command line

Above are the basic steps you neeed to know to launch your own cotainer. You can then head over here to know more docker commands and experiment with them.

Now that we have learnt to launch a container, let's go ahead and learn how to build our own container.

How to build a docker container?

Now we need to build a docker image of our own.Let's consider we have an application we are tyring to conatinerize, we can follow few basic steps to to be able to achieve this.

Docker Images always start from a base image. The base image should include the platform dependencies required by our application.The base image is defined as an instruction in the Dockerfile. Docker Images are built based on the contents of a Dockerfile. The Dockerfile is a list of instructions describing how to deploy your application.

The Dockerfile is used by the Docker CLI build command. The build command executes each instruction within the Dockerfile. The result is a built Docker Image that can be launched and run your configured app.

A Dockerfile defines all the steps required to create a Docker image with our application configured and ready to be run as a container. The image itself contains everything, from operating system to dependencies and configuration required to run our application.Having everything within the image allows us to migrate images between different environments and be confident that if it works in one environment, then it will work in all other environments.

Useful Resources

1) Katacoda resources for hands-on labs for docker
2) How to build custom docker images