|
Docker is now more and more fire, and substituted KVM trend, of course, I think that still have their advantages, I contacted Docker is currently limited to the message text on the original text of this article is Howtoforge, so the translation may be lacking local, please correct me.
Docker is an open source project, developers and system administrators to provide an open platform, in any place and run applications through packaged as a lightweight container. Docker automatic deployment of applications in the software container. Docker beginning by the Solomon Hykes dotCloud as an internal development project, an enterprise PaaS (platform as a service platform and services), the software is now maintained by the community and Docker Docker companies Docker more information you can visit: https: // docs.docker.com/.
We can provide through the official KVM and Docker Docker images more images of know what Dock:
Docker install the required conditions: the need for 64-bit architecture of the system and the Linux 3.10 kernel or later. Here the authors use kernel version 3.19 Ubuntu15.04 system.
Learn more about some of Docker
Here you can learn the most basic conditions docker world.
Docker Images
Docker image Docker container is the most basic template. image generic container and make the system easy to install applications, Docker image is used to run the container, you can find a lot of images (multiple operating systems and the software has been installed in Docker) here https://hub.docker.com /.
Docker Container
Docker container (Docker Container) is an Image, to read and write on a running Docker image. Docker is a combined file system as a container background, any change in the container will be stored on a new basic image layer. We install the application layer is the container. Each container run on the host machine are independent, thus providing a secure application platform.
Docker Registry
Docker registry for Docker images provided by the library. It provides public and private libraries. Public libraries are called Docker Docker Hub. Here we are able to push and pull to upload our own images.
Docker installed on Ubuntu 15.04
Below we will guide you how to install the docker. We need to check before installing the operating system kernel version and architecture.
Run the command:
uname -a
You can see that we are using ubuntu 15.04 64-bit version of the kernel and kernel 3.19.
Docker now run the installation command:
sudo apt-get install -y docker.io
Wait until the installation is completed, and now we use the following command to start Docker:
systemctl start docker
Runtime enable docker boot command:
systemctl enable docker
You may want to check the docker version:
docker version
Now, docker already installed on your system. You can download a container made from Docker Docker Image Library.
Basic usage of Docker
In this section, I will introduce you to common options Docker command. Such as how to download a docker image, create a container, as well as how to access the container.
To create a new container, you should choose a basic image of the operating system, such as start Ubuntu or CentOS or other systems. You can search using a basic image Docker search command:
docker search ubuntu
This command displays all ubuntu images, you can try your own search centos Images.
Now we now base image to our service, use the command:
docker pull ubuntu
Now, you can view all downloaded images by using the command:
docker images
Ubuntu image download from DockerHub / Docker Registry. The next step is to create the container from the mirror.
To create the container, you can use docker create or docker run
docker create ubuntu: 14.04
docker create command creates a new container, but it will not start. So now you need to use the command:
docker run -i -t ubuntu: 14.04 / bin / bash
This command will create and run a Ubuntu14.04 mirror-based container, the container and run a command / bin / bash, you will automatically run the command in the container.
When you enter the Exit command to exit the container, the container is stopped, if you want to run in the background container in the command, append -d parameter.
docker run -i -t -d ubuntu: 14.04 / bin / sh -c "while true; do echo hello world; sleep 1; done"
/ Bin / sh -c "while true; do echo hello world; sleep 1; done" this is bash script to echo "hello word" forever.
Now you can see the container run in the background by the command:
docker ps
If you want to see the log results from the bash command, use the command:
docker logs NAMES / ContainerID
How to access the container shell in the background? This command will connect your container shell:
docker exec -i -t NAMES / ContainerID
You can see the host name and the container ID is equal, which means that you are within the container shell. When you type 'exit`, will leave the shell on the shell, but the container is still running.
You will often use another command is:
docker stop NAME / ContainerID
This will stop the container without deleting it, so you can restart it with the command:
docker start NAME / ContainerID
If you want to delete a container, stop it, then use the command to delete it:
docker rm NAME / ContainerID |
|
|
|