Tutorial 1 : Getting started with Docker
Pre-requisite : Install Docker in your machine.
Note: I have installed Docker in Windows 10 using Docker Quickstart Terminal.
Run following command in a command prompt to check Docker version after installation :
docker --version
Output :
First let’s get acquainted with the terminologies involved.
What is Docker ?
- software platform to package and deploy application with all it’s dependencies (libraries with specific version like Python 3.9, numpy 1.19.3, etc.)
Why Docker ?
- every application needs installation of all the required dependencies
- installation process depends upon Operating System of machine
- multi-step task so it could go wrong
- Docker is one stop solution for all these issues without having to worry about version mismatch in a machine since it is done in an isolated environment
Steps :
- create a Dockerfile
- Docker image is built from Dockerfile
- running the Docker image creates a Docker container
Dockerfile :
- a text document with all the commands required to create Docker image
Docker image :
- a set of instructions for all the installation of dependencies and other code required for application
Docker container :
- running Docker image
What is Docker Hub ?
- service provided by Docker for finding and sharing Docker images
You will understand these concepts better when we use it in a code.
Pulling the Docker image from Docker Hub :
Run following command in a command prompt :
docker pull hello-world
Output :
Above output clearly shows that docker image is pulled successfully.
Running the Docker image:
Running the Docker image will create docker container :
docker run hello-world
Output :
Running container flashes the message “Hello from Docker” in a command prompt.
Now that you know how to pull and run the Docker image from Docker Hub, how can you find out how many images and containers are there ?
Take a deep breath and move to the next tutorial .