Getting Familiar With Docker Commands Docker Terms: Docker - Part 3 A
Docker Linux Linux Commands Tutorials

Getting Familiar With Docker Commands Docker Terms: Docker – Part 3 A

In the tutorial, we will get familiar with Docker terms and its terminology. Here I have compiled almost every command used in Docker and its implementation

Just in case, if  you did miss Previous two tutorial regarding Docker can be read here:

Part 1: What Is Docker And Concept Of Containers With Virtualization?
Part 2: How To Install Docker On CentOS/RHEL 6/7? And Learn Docker HUB Registration
Part 3B: Getting Familiar With Docker Commands Docker Terms: Docker – Part 3 B
Part 4: How To Perform Task Like Install, Run And Delete Applications Inside Docker Containers

So Let’s dig out Command in Docker

In Docker, everything is based on Images. An image is a combination of a file system and parameters. So most of our command will move around images.

Command 1: Create an Instance of Container

This command is used to create an instance of a container from an image.

  • The Docker command tells the Docker program on the Operating System that something needs to be done.
  • The run command is used to mention that we want to create an instance of an image, called a container.
  •  “hello-world” represents the image from which the container is made.



Command 2: Docker Information

This Command will show all the detailed information.

Command 3: Docker Version

This command will help you to check out the running version of Docker of client end and server end.

Comand 4: List Docker Commands

To get a list of all the command that works on docker on the console, you may hit below command on terminal. All the command and arguments will get populated on the terminal.

Note: You Cab Use Run ‘docker COMMAND –help‘ for more information on a command

Command 5: Login Docker HUB or Docker Registry

Docker Registry or Docker HUB is used for searching and to pull Docker images(like CentOs, Ubuntu etc.) from the Docker HUB. Also, you can push and update your images to Docker HUB for future use and there are other many things you can do with Docker HUB.

You need an account on Docker HUB to get logged in. If you don’t have account yo can learn it from Part 2. Following is the Command to Login into Docker HUB or Docker Registry:

Command 5: To Seach Images With Doker HUB

Soon After logging into Docker HUB, you are eligible for PULL, PUSH, Search, Update docker image from Docker HUB. These images can be used for creating containers. Docker Hub has lots of community free images created for you like Ubuntu image mongo image and a much more great deal of free images from its repositories. Following command is used to search centOS images from the repository.



Command 6: Download Docker image

After logging in and searching out images from docker you can pull these image i=on yu local system using the following command.

Command 7: List Docker Images On Local System

Now when you have lots of downloaded docker images you can look all the docker images present on you local system by the following command.

TAG − This is used to logically tag images.
Image ID − This is used to uniquely identify the image.
Created − The number of days since the image was created.
Virtual Size − The size of the image.

Command 8: Remove Docker Image

When you have lots of running which are obsolete or you no longer need any Docker image then you can remove that image using the following command.

Syntex: docker rmi ImageName

Command 9: Run A Docker Container

The concept is little catchy, whenever a command is sent for execution in the Docker Image, a container in obtained. When this command execution is finished,  the container gets stopped (a non-running or exited container state). It Means at every command execution into the same image a new container is created again and again and exited.

All these created containers remain on host filesystem. You can delete them by using the docker rm command. To run or create a container use the following command:

Syntex: docker run [local image] [command to run into container]

Command 10: List Running Docker Containers

Whenever a command execution is performed on a Docker Image a container is created and gets stopped after execution but it remains in exited or non-running state. The following command will display a list of the running and stopped (non-running) containers:

Note: ContainerID will be used in many actions. This command also gives you information like CONTAINER ID, IMAGE, COMMAND, CREATED, STATUS, PORTS, NAMES.

Command 11: Start A Container

Now We have a ContainerID so we can start the container again with the command that was used to create it, by using the following command

Syntex: docker start ContainerID

Command 12: Listing of Containers (Expended)

In a production environment there are many running containers and to list them we have command. This command is used to get the currently running containers.

This Can also be used with ‘-a’ argument and this command will list all of the containers on the system

Continue Reading With PART 3B and learn more commands to complete this tutorial.



Read More:

Part 1: What Is Docker And Concept Of Containers With Virtualization?
Part 2: How To Install Docker On CentOS/RHEL 6/7? And Learn Docker HUB Registration
Part 3A: Getting Familiar With Docker Commands Docker Terms: Docker – Part 3 A
Part 3B: Getting Familiar With Docker Commands Docker Terms: Docker – Part 3 B
Part 4: How To Perform Task Like Install, Run And Delete Applications Inside Docker Containers

Kapendra
Love to write technical stuff with personal experience as I am working as a Sr. Linux Admin. and every day is a learning day and Trust me being tech geek is really cool.
http://kapendra.com

Leave a Reply