Docker:-
Docker is the most revolutionized technology in virtualization world nowadays. Docker is actually an open source project which provides container technology. A container is a lightweight VM(virtual machine) or a process which allows us to install Linux based applications inside it. The container doesn’t have its own Kernel, RAM, CPU and Disk but it uses the underlying OS kernel, RAM, CPU cores and Disk.
The container provides process base isolation where virtual machines provide resource-based isolation. The main benefit of containers is that we can provide a container in less than a second because launching containers is actually starting a process in Linux.
Verify that you now have the key with the fingerprint 9DC8 5822 9FC7 DD38 854A E2D8 8D81 803C 0EBF CD88, by searching for the last 8 characters of the fingerprint.
By Default Containers can reach to the outside world and each outgoing connection will appear as if the request is coming from docker’s host IP address but from outside world, no one reaches to containers.
Using port translation method we allow outsiders to reach our containers.
Let’s suppose I want to host a website inside a container and this container will be accessed by Web developers via ssh
Docker is the most revolutionized technology in virtualization world nowadays. Docker is actually an open source project which provides container technology. A container is a lightweight VM(virtual machine) or a process which allows us to install Linux based applications inside it. The container doesn’t have its own Kernel, RAM, CPU and Disk but it uses the underlying OS kernel, RAM, CPU cores and Disk.
The container provides process base isolation where virtual machines provide resource-based isolation. The main benefit of containers is that we can provide a container in less than a second because launching containers is actually starting a process in Linux.
In this article, we will discuss how to setup Docker on Ubuntu server 16.04. Prerequisite of Docker is listed below :
Step: 1- Update the package database:
Let's update the package database to start the installation of docker using apt-get update command.
Let's update the package database to start the installation of docker using apt-get update command.
Step: 2- Add GPG key for docker's official repository
Install packages to allow apt to use a repository over HTTPS:
Docker package is not available in the default Ubuntu 16.04 server’s repositories. Let’s add the GPG key for docker repository using below command.
Now add docker repository using 'apt-add-repository' command.
Update the package index by updating the package database
Step: 3- Install docker ce package using the command below
Use the following command to install the latest version of Docker.
Step: 4- Verify your Docker-ce installation by running the command below
If your Docker installation is correct you will see the message like below.
Search Docker image using docker search command.
Let's assume you would like to search Ubuntu image, run the command below.
Your search result will be like this.
Download Docker image using "docker pull" command.
The above command will download the latest Ubuntu image. To list all the locally available images run the command " sudo docker images".
Launch a container using "docker run" command.
Where in the above command.
sudo docker run It is a command.
-it "i" for interactive and "t" is terminal
--name To define container name
ubuntu Docker image name
To stop the container type 'exit' in the container console. if you don't want to stop the container but want to go back docker main console press 'ctrl+p+q' in the container console.
Verify how many container running currently
To verify how many containers currently running use the command ' docker ps'
Stop a container using 'docker stop' command.
Let's stop recently created container1
Start a container in detach mode
Let's suppose you want to start a container but don't want to go into the console '-dit' will launch the container in the background.
Binding Container ports to Docker host
Using port translation method we allow outsiders to reach our containers.
Let’s suppose I want to host a website inside a container and this container will be accessed by Web developers via ssh
Delete container using 'docker rm' command
Use ‘docker rm‘ command to delete containers either based on their names and ids, Before deleting a container make sure it is stopped.
Remove Docker Image using 'docker rmi' command
‘docker rmi‘ command is used to delete or remove docker images from host’s local image repository
Thanks for reading my blog. Please leave your comments and suggestion to make it better.
Excellent work, thanks for sharing...
ReplyDelete