Docker is an open-source tool that automates the deployment of applications inside software containers by providing an additional layer of abstraction of operating system level virtualization on Linux. Docker makes it easier to create, deploy and run applications by using containers.
Containers allow a developer to package up an application with all of the libraries and dependencies, and ship it all out as one package.
Docker is same as virtual machine, rather than creating a whole virtual operating system. Docker allows applications to use the same Linux kernel as the system that they are running on. This gives a significant performance boost and reduces the size of the application.
Docker is preferred by many system admins and developers to maximize their creativity in an App production environment.
For system admins, Docker gives flexibility and reduces the number of systems needed because of its small footprint and lower overhead.
In this tutorial, We'll learn how to install Docker on CentOS-7.
CentOS-7 64-bit configured with static IP address.
Kernel version must be 3.10 at minimum.
It is recommended to update your system before installing docker.
To update the system, Run:
sudo yum -y update
Docker package is not available in CentOS-7 repository. So you need to create repo for docker.
You can create docker repo by creating docker.repo file inside /etc/yum.repos.d/ directory.
Now, You just run one command to setup a basic CentOS container with a bash shell.
To run a command in new container, Run:
sudo docker run -i -t centos /bin/bash
Note: -i flag attaches stdin and stdout and -t flag allocates a tty.
That's it. Now you're using a bash shell inside of a centos docker container.
There are many containers already available on docker website. You can found any container through a search.
For example to search centos container, Run:
sudo docker search centos
You can see the output some thing like this:
NAME DESCRIPTION STARS OFFICIAL AUTOMATED
centos The official build of CentOS. 2079 [OK]
jdeathe/centos-ssh CentOS-6 6.7 x86_64 / CentOS-7 7.2.1511 x8... 19 [OK]
jdeathe/centos-ssh-apache-php CentOS-6 6.7 x86_64 / Apache / PHP / PHP M... 14 [OK]
million12/centos-supervisor Base CentOS-7 with supervisord launcher, h... 10 [OK]
blalor/centos Bare-bones base CentOS 6.5 image 8 [OK]
nimmis/java-centos This is docker images of CentOS 7 with dif... 8 [OK]
torusware/speedus-centos Always updated official CentOS docker imag... 7 [OK]
centos/mariadb55-centos7 3 [OK]
nickistre/centos-lamp LAMP on centos setup 3 [OK]
nathonfowlie/centos-jre Latest CentOS image with the JRE pre-insta... 3 [OK]
consol/sakuli-centos-xfce Sakuli end-2-end testing and monitoring co... 2 [OK]
timhughes/centos Centos with systemd installed and running 1 [OK]
darksheer/centos Base Centos Image -- Updated hourly 1 [OK]
softvisio/centos Centos 1 [OK]
lighthopper/orientdb-centos A Dockerfile for creating an OrientDB imag... 1 [OK]
yajo/centos-epel CentOS with EPEL and fully updated 1 [OK]
grayzone/centos auto build for centos. 0 [OK]
ustclug/centos USTC centos 0 [OK]
januswel/centos yum update-ed CentOS image 0 [OK]
dmglab/centos CentOS with some extras - This is for the ... 0 [OK]
jsmigel/centos-epel Docker base image of CentOS w/ EPEL installed 0 [OK]
grossws/centos CentOS 6 and 7 base images with gosu and l... 0 [OK]
labengine/centos Centos image base 0 [OK]
lighthopper/openjdk-centos A Dockerfile for creating an OpenJDK image... 0 [OK]
blacklabelops/centos CentOS Base Image! Built and Updates Daily! 0 [OK]
You can also list all available images on your system using the following command:
sudo docker images
You can see the output some thing like this:
REPOSITORY TAG IMAGE ID CREATED SIZE
firefox-instance latest 8e61bff07fa0 3 weeks ago 354.6 MB
centos latest d0e7f81ca65c 4 weeks ago 196.6 MB
debian latest f50f9524513f 4 weeks ago 125.1 MB
apache/ubuntu latest 196655130bc9 4 weeks ago 224.1 MB
apache-instance latest 7da78270c5f7 4 weeks ago 224.1 MB
apache-instance ubuntu 7da78270c5f7 4 weeks ago 224.1 MB
hitjethva/apache-instance ubuntu 7da78270c5f7 4 weeks ago 224.1 MB
##Docker basic command lines
Let's start with seeing all available commands docker have.
You can list all available docker command by running the following command:
You should see the following output:
attach Attach to a running container
build Build an image from a Dockerfile
commit Create a new image from a container's changes
cp Copy files/folders between a container and the local filesystem
create Create a new container
diff Inspect changes on a container's filesystem
events Get real time events from the server
exec Run a command in a running container
export Export a container's filesystem as a tar archive
history Show the history of an image
images List images
import Import the contents from a tarball to create a filesystem image
info Display system-wide information
inspect Return low-level information on a container or image
kill Kill a running container
load Load an image from a tar archive or STDIN
login Register or log in to a Docker registry
logout Log out from a Docker registry
logs Fetch the logs of a container
network Manage Docker networks
pause Pause all processes within a container
port List port mappings or a specific mapping for the CONTAINER
ps List containers
pull Pull an image or a repository from a registry
push Push an image or a repository to a registry
rename Rename a container
restart Restart a container
rm Remove one or more containers
rmi Remove one or more images
run Run a command in a new container
save Save an image(s) to a tar archive
search Search the Docker Hub for images
start Start one or more stopped containers
stats Display a live stream of container(s) resource usage statistics
stop Stop a running container
tag Tag an image into a repository
top Display the running processes of a container
unpause Unpause all processes within a container
update Update resources of one or more containers
version Show the Docker version information
volume Manage Docker volumes
wait Block until a container stops, then print its exit code
Run 'docker COMMAND --help' for more information on a command.
Truth be told, it’s difficult for a web application that doesn’t have some kind of identification, even if you don’t see it as a security measure in and of itself. The Internet is a kind of lawless land, and even on free services like Google’s, authentication ensures that abuses will...
Although data persistence is almost always a fundamental element of applications, Node.js has no native integration with databases. Everything is delegated to third-party libraries to be included manually, in addition to the standard APIs. Although MongoDB and other non-relational databases are the most common choice with Node because if you...