... | @@ -7,8 +7,8 @@ |
... | @@ -7,8 +7,8 @@ |
|
# Index
|
|
# Index
|
|
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-command)
|
|
4. [Docker Basic Command](#docker-basic-commands)
|
|
5. [Creating Docker application](#creating-an-application)
|
|
5. [Common Docker operations](#creating-an-application)
|
|
|
|
|
|
|
|
|
|
## Why docker ?
|
|
## Why docker ?
|
... | @@ -144,7 +144,7 @@ Typically, you will be using docker in the given flow. |
... | @@ -144,7 +144,7 @@ Typically, you will be using docker in the given flow. |
|
|
|
|
|
---
|
|
---
|
|
|
|
|
|
Commands for doing the operations on docker are
|
|
Example of the above flow:
|
|
|
|
|
|
**1. Download the docker.**
|
|
**1. Download the docker.**
|
|
|
|
|
... | @@ -152,21 +152,18 @@ Commands for doing the operations on docker are |
... | @@ -152,21 +152,18 @@ Commands for doing the operations on docker are |
|
docker pull snehabhapkar/trydock
|
|
docker pull snehabhapkar/trydock
|
|
```
|
|
```
|
|
|
|
|
|
This is an empty docker image.
|
|
|
|
|
|
|
|
**2. Run the docker image with this command.**
|
|
**2. Run the docker image with this command.**
|
|
|
|
|
|
```shell
|
|
```shell
|
|
docker run -ti snehabhapkar/trydock /bin/bash
|
|
docker run -ti snehabhapkar/trydock /bin/bash
|
|
```
|
|
```
|
|
|
|
|
|
Which will output like this
|
|
Which will output like this, this means that now you are running the docker container and you are inside the container.
|
|
|
|
|
|
```shell
|
|
```shell
|
|
root@e0b72ff850f8:/#
|
|
root@e0b72ff850f8:/#
|
|
```
|
|
```
|
|
|
|
Every running container has an ID in your system. Container ID in my case is `e0b72ff850f8`.
|
|
This will create a container ID in your system for this image. Container ID in my case is e0b72ff850f8.
|
|
|
|
|
|
|
|
**3. Let copy our code inside docker with this command.** (Make sure you are not inside docker terminal, enter `exit` in command line to get out of container terminal)
|
|
**3. Let copy our code inside docker with this command.** (Make sure you are not inside docker terminal, enter `exit` in command line to get out of container terminal)
|
|
|
|
|
... | @@ -198,6 +195,7 @@ docker cp requirements.sh e0b72ff850f8:/ |
... | @@ -198,6 +195,7 @@ docker cp requirements.sh e0b72ff850f8:/ |
|
```
|
|
```
|
|
|
|
|
|
**4. Install dependencies**
|
|
**4. Install dependencies**
|
|
|
|
If you want to install additional dependencies then you can, write all the steps for installation in a shell script and run the script inside the container.
|
|
|
|
|
|
* Give permission to run shell script
|
|
* Give permission to run shell script
|
|
|
|
|
... | @@ -228,7 +226,7 @@ docker commit e0b72ff850f8 snehabhapkar/trydock |
... | @@ -228,7 +226,7 @@ docker commit e0b72ff850f8 snehabhapkar/trydock |
|
|
|
|
|
where e0b72ff850f8 is the containerID.
|
|
where e0b72ff850f8 is the containerID.
|
|
|
|
|
|
**7. Push docker image to the dockerhub and share repository name in the summary of assignment.**
|
|
**7. Push docker image to the dockerhub.**
|
|
|
|
|
|
* Tag image name with different name
|
|
* Tag image name with different name
|
|
|
|
|
... | @@ -238,13 +236,16 @@ docker tag snehabhapkar/trydock username/repo |
... | @@ -238,13 +236,16 @@ docker tag snehabhapkar/trydock username/repo |
|
|
|
|
|
where username is your username on dockerhub and repo is the name of image.
|
|
where username is your username on dockerhub and repo is the name of image.
|
|
|
|
|
|
|
|
For example:
|
|
|
|
```sh
|
|
|
|
docker tag snehabhapkar/trydock yh42/trial-dock-img
|
|
|
|
```
|
|
|
|
|
|
* Push on dockerhub
|
|
* Push on dockerhub
|
|
|
|
|
|
```shell
|
|
```shell
|
|
docker push username/repo
|
|
docker push username/repo
|
|
```
|
|
```
|
|
|
|
|
|
and submit the link to your repository in the docker summary.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|