Brief introduction
Docker is an open source project that provides developers and system administrators with an open platform for packaging and running applications everywhere as a lightweight container. Docker automatically deploys applications within the software container. Docker was initially Solomon Hykes as an in-house development project, an enterprise-class PaaS (platform as a service platform), which is now maintained by the Docker community and Docker companies.
We can get a better image of what the Dock is by Docker the official KVM and Docker pictures that are available:
Conditions required to install Docker: a 64-bit architecture-required system and a Linux 3.10 kernel or later. Here the author uses the 3.19 kernel version of the Ubuntu15.04 system.
One, about Docker to know a little more
Here you can learn about the most basic conditions in the Docker world.
Docker Images
Docker image is the most basic template for Docker container. Image Universal container makes system and application easy to install, Docker image is used to run the container, you can find many images (various operating systems and software have been installed Docker) here https://hub.docker.com/.
Docker Container
The Docker container (Docker Container) is an image that is read and written on the running Docker image. Docker is a federated file system in the background of the container, any changes to the container will be kept on a new layer of basic image. The layer where we install the application is the container. Each container running on the host is independent, thus providing a secure application platform.
Docker Registry
Docker Registry is a library provided for Docker images. It provides both public and private libraries. The public Docker library is called the Docker Hub. Here we can upload push and pull our own images.
Second, install Docker on Ubuntu 15.04
Below we will instruct you how to install Docker. We need to check the kernel version and the operating system architecture before installing.
To run the command:
You can see that we are using the Ubuntu 15.04 64-bit version and the kernel 3.19 kernel.
Now run the command to install Docker:
Waiting for installation to complete, now we use the following command to start Docker:
Enable Docker when running system boot, command:
You might want to check the Docker version:
The Docker is now installed on your system. You can download Docker Image-made containers from the Docker library first.
Iii. basic usage of Docker
In this section, I'll introduce you to the common options for the Docker command. For example, how to download a docker image, build a container, and access the container.
To create a new container, you should select an operating system with a basic image, such as starting Ubuntu or CentOS or other systems. You can search for a
Basic image uses the Docker Search command:
This command will show all Ubuntu images and you can try your search for CentOS images yourself.
Now we now base image into our service, using the command:
You can now view all downloaded images by using a command:
Ubuntu mirrors are downloaded from Dockerhub/docker registry. The next step is to create a container from the mirror.
To create a container, you can use Docker create or Docker run.
The docker create command creates a new container, but does not start it. So now you need to use the Run command:
This command creates and runs a container based on the Ubuntu14.04 Mirror, and runs a command/bin/bash inside the container, and you run the command automatically within the container.
When you enter the Exit command to exit the container, the container also stops running, and if you want the container to run in the background, you need to add the-d parameter after the command.
Docker run-i-t-d Ubuntu:14.04/bin/sh-c "while true; do echo Hello world; Sleep 1; Done
Now you can see the container running in the background by command:
If you want to see the log results from bash commands, use the command:
How do I access the container shell in the background? This command will connect your container shell:
You can see that the host name and the container ID are equal, which means that you are inside the container shell. When you type ' exit ' on the shell, the shell is left, but the container is still running.
Another command that you will often use is:
This stops the container without deleting it, so you can restart it with a command:
If you want to remove the container, stop it first, and then use the command to remove it:
Summarize
Docker is now more and more fire, there is a trend to replace the KVM, of course, I think there are various advantages, the above is the entire content of this article, I hope the content of this article for everyone to learn or use Docker can help, if you have questions you can message exchange.