What is the use of ps command?

docker PS command gives user the ability to monitor all the created containers in the system.


> docker ps

Command shows all the containers which are currently running in the system. Adding an -a flag to the command shows all the containers which are available in the system (both running and stopped).

What is the use of it flag?

The "it" flag is used in a RUN or EXEC command, which is a combination of two individual flags i and t.

i stands for interactive, which connects the user terminal to the STDIN of the container. The t flag refers to pseudo-tty which pretty prints the STDOUT channel of the container.

Example:


> docker run -it ubuntu bash

The above command runs an ubuntu container and connects the bash command output to the user terminal, which results in the ability for user to send and receive I/O onto the container.

What is the difference between a START and RUN command?

START command is used to start an already created container. On the other hand, a RUN command is used to CREATE and START a non-existing container from a specified image.

So basically a docker RUN command does both CREATE and START commands combined.


> docker run [options] <image_name> [initial_command]

How do you start a docker container?

To start an already created container, we use the below command:


> docker start [options] <container_id> [<container_id> ..]

Where container_id is the unique identifier referring to a created container. This is the value returned when we run a docker create command.

How do you create a container in docker?

A container for a specified image can be created in docker by the below command:


> docker create [options] <image_name> <initial_command>

This command takes an existing docker image name as a parameter and returns a container_id for the created container. This container_id is used for working with the created container

What is meant by an image?

An image is a trimmed down version of operating system along with a specific set of resources pre-installed, which is downloaded from the docker repository and setup in the client machine (our machine) for use. In Docker, an image is used as a base in building a container which contains all the required dependencies along with the environment for the application to run without any hosting issues.

What is meant by a Container?

A container is an encapsulated environment which allows developer to pack all the necessary libraries and dependencies for running an application without any issues and deploy the entire container as an instance.

What are DQL commands?

DQL or Data Query Language commands are used for querying data from database objects. This is only a single command which can result in records from dbo such as tables, views etc and can be subject to projection.

SELECT [ DISTINCT column_1, column_2 .. | * ]
FROM <table_name>
WHERE <query_condition>
GROUP BY <columns_list>
HAVING <condition>
ORDER BY <columns_list> [ ASC | DESC ]