... | ... | @@ -8,7 +8,7 @@ |
|
|
1. [Docker Terminologies](#docker-terminologies)
|
|
|
2. [Docker Installation (ubuntu16.04)](#docker-installation)
|
|
|
4. [Docker Basic Command](#docker-basic-commands)
|
|
|
5. [Common Docker operations](#creating-an-application)
|
|
|
5. [Common Docker operations](#common-operations-on-dockers)
|
|
|
|
|
|
|
|
|
## Why docker ?
|
... | ... | @@ -71,6 +71,8 @@ Learn basic docker commands |
|
|
|
|
|
## docker ps
|
|
|
* The docker ps command allows us to view all the containers that are running on the Docker Host.
|
|
|
|
|
|
for Example:
|
|
|
```sh
|
|
|
$ docker ps
|
|
|
|
... | ... | @@ -78,26 +80,8 @@ CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES |
|
|
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
|
|
|
* This command starts any stopped container(s).
|
|
|
* Syntax
|
|
|
```sh
|
|
|
$ docker start [options] CONTAINER ID/NAME [CONTAINER ID/NAME…]
|
|
|
```
|
|
|
* Example
|
|
|
```sh
|
|
|
$ docker start 30986
|
... | ... | @@ -110,10 +94,6 @@ Whereas in this example, Docker starts the container named sneha. |
|
|
|
|
|
## docker stop
|
|
|
* This command stops any running container(s).
|
|
|
* Syntax
|
|
|
```sh
|
|
|
$ docker stop [options] CONTAINER ID/NAME [CONTAINER ID/NAME…]
|
|
|
```
|
|
|
* Example
|
|
|
```sh
|
|
|
$ docker stop 30986
|
... | ... | @@ -124,10 +104,18 @@ $ docker stop sneha |
|
|
```
|
|
|
Whereas in this example, Docker will stop the container named sneha.
|
|
|
|
|
|
## docker restart
|
|
|
## docker run
|
|
|
* This command creates containers from docker images.
|
|
|
* Example
|
|
|
```sh
|
|
|
$ docker run sneha
|
|
|
```
|
|
|
## docker rm
|
|
|
|
|
|
* This command deletes the containers.
|
|
|
* Example
|
|
|
```sh
|
|
|
$ docker rm sneha
|
|
|
```
|
|
|
|
|
|
## Common Operations on Dockers
|
|
|
|
... | ... | |