... | @@ -8,7 +8,7 @@ |
... | @@ -8,7 +8,7 @@ |
|
1. [Docker Terminologies](#docker-terminologies)
|
|
1. [Docker Terminologies](#docker-terminologies)
|
|
2. [Docker Installation (ubuntu16.04)](#docker-installation)
|
|
2. [Docker Installation (ubuntu16.04)](#docker-installation)
|
|
4. [Docker Basic Command](#docker-basic-commands)
|
|
4. [Docker Basic Command](#docker-basic-commands)
|
|
5. [Common Docker operations](#creating-an-application)
|
|
5. [Common Docker operations](#common-operations-on-dockers)
|
|
|
|
|
|
|
|
|
|
## Why docker ?
|
|
## Why docker ?
|
... | @@ -71,6 +71,8 @@ Learn basic docker commands |
... | @@ -71,6 +71,8 @@ Learn basic docker commands |
|
|
|
|
|
## docker ps
|
|
## docker ps
|
|
* The docker ps command allows us to view all the containers that are running on the Docker Host.
|
|
* The docker ps command allows us to view all the containers that are running on the Docker Host.
|
|
|
|
|
|
|
|
for Example:
|
|
```sh
|
|
```sh
|
|
$ docker ps
|
|
$ docker ps
|
|
|
|
|
... | @@ -78,26 +80,8 @@ CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES |
... | @@ -78,26 +80,8 @@ CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES |
|
30986b73dc00 ubuntu "bash" 45 minutes ago Up About a minute elated_franklin
|
|
30986b73dc00 ubuntu "bash" 45 minutes ago Up About a minute elated_franklin
|
|
```
|
|
```
|
|
|
|
|
|
docker ps output details
|
|
|
|
|
|
|
|
* **CONTAINER ID:** A unique string consisting of alphanumeric characters, associated with each container.
|
|
|
|
|
|
|
|
* **IMAGE:** Name of the Docker Image used to create this container.
|
|
|
|
|
|
|
|
* **COMMAND:** Any application-specific command(s) that needs to be executed when the container is started.
|
|
|
|
|
|
|
|
* **CREATED:** This shows the time elapsed since this container has been created.
|
|
|
|
|
|
|
|
* **STATUS:** This shows the current status of the container, along with the time elapsed, in its present state.
|
|
|
|
* **PORTS:** This displays any port mappings defined for the container.
|
|
|
|
* **Names:** Apart from the CONTAINER ID, each container is also assigned a unique name. We can refer to a container either using its container ID or its unique name.
|
|
|
|
|
|
|
|
## docker start
|
|
## docker start
|
|
* This command starts any stopped container(s).
|
|
* This command starts any stopped container(s).
|
|
* Syntax
|
|
|
|
```sh
|
|
|
|
$ docker start [options] CONTAINER ID/NAME [CONTAINER ID/NAME…]
|
|
|
|
```
|
|
|
|
* Example
|
|
* Example
|
|
```sh
|
|
```sh
|
|
$ docker start 30986
|
|
$ docker start 30986
|
... | @@ -110,10 +94,6 @@ Whereas in this example, Docker starts the container named sneha. |
... | @@ -110,10 +94,6 @@ Whereas in this example, Docker starts the container named sneha. |
|
|
|
|
|
## docker stop
|
|
## docker stop
|
|
* This command stops any running container(s).
|
|
* This command stops any running container(s).
|
|
* Syntax
|
|
|
|
```sh
|
|
|
|
$ docker stop [options] CONTAINER ID/NAME [CONTAINER ID/NAME…]
|
|
|
|
```
|
|
|
|
* Example
|
|
* Example
|
|
```sh
|
|
```sh
|
|
$ docker stop 30986
|
|
$ docker stop 30986
|
... | @@ -124,10 +104,18 @@ $ docker stop sneha |
... | @@ -124,10 +104,18 @@ $ docker stop sneha |
|
```
|
|
```
|
|
Whereas in this example, Docker will stop the container named sneha.
|
|
Whereas in this example, Docker will stop the container named sneha.
|
|
|
|
|
|
## docker restart
|
|
|
|
## docker run
|
|
## docker run
|
|
|
|
* This command creates containers from docker images.
|
|
|
|
* Example
|
|
|
|
```sh
|
|
|
|
$ docker run sneha
|
|
|
|
```
|
|
## docker rm
|
|
## docker rm
|
|
|
|
* This command deletes the containers.
|
|
|
|
* Example
|
|
|
|
```sh
|
|
|
|
$ docker rm sneha
|
|
|
|
```
|
|
|
|
|
|
## Common Operations on Dockers
|
|
## Common Operations on Dockers
|
|
|
|
|
... | | ... | |