Immediately before the blog, this article mainly writes how to use Docker
Introduction of series 1:docker: http://blog.csdn.net/u013469562/article/details/72864323
Series 2:docker Installation: http://blog.csdn.net/u013469562/article/details/72865167
first, the Docker image acquisition 1.1 Search for available mirrorsDocker official provides an official mirror market https://hub.docker.com/, can search for some mirror files, such as Centos,jdk
Of course, we don't usually use this way to get a piece of it is through the command line first with the Docker search [keyword] command to see what the Docker hub on the image can be downloaded, search can be used to represent the keyword:
1.2 Download MirrorsHere you can see that there are many versions of the CentOS, where each centos is a mirror, you can choose the appropriate version of the CentOS download. Next, download the mirror with the Docker pull [Repository/url:tag] command. Because from the official Docker hub download very slow, so here from the domestic mirror station NetEase's honeycomb (or https://hub.daocloud.io/) Https://c.163.com/hub download It can also search on the Web page, very fast. (Note: The following will be used to create a container with the Docker Run command, in fact, if the mirror does not exist Docker will automatically download, here to learn pull command so manual download mirror) netease very intimate help you put the Docker commands are written: Docker pull Hub.c.163.com/public/centos:6.7-tools, as the right side of the graph
Where the Docker pull of the Docker pull Hub.c.163.com/public/centos:6.7-tools in this line of command is fixed, if the full name of the rear-view image is directly downloaded from the official warehouse, The red line part of the image below is the full name of the mirror, but you can also follow the tag representative to download different versions such as Docker pull Hub.c.163.com/public/centos:6.7-tools:latest to download the latest version, The version can be queried in the warehouse to find a specific version. For example, to view centos6.5, you can use Docker search centos:6.5
Once the download is complete, you can use Docker images to see which mirrors are locally available, as shown in the following image, which shows that a mirrored image has just been downloaded.
There may be three types of repository columns here: [Namespace/centos]: When you register your account on the Docker hub, the account name automatically becomes your namespace, which is used to differentiate the mirrors of different users. [CentOS]: This is only the name of the warehouse can be considered to belong to the top namespace, this warehouse only for official mirrors. The Hub.c.163.com/public/centos:6.7-tools]:url path indicates that the mirror is placed on a third-party hub. 1.3 Creating and starting containers
Once you understand the basics of mirroring, we can create a container. First create the container with the Docker creation or use Docker Run [Repository:tag] to create and run the container. Containers can be divided into two types: interactive containers: front-run, which can interact with the container through the console. If the terminal that created the container is closed, the container becomes a stopped state. In addition, you can terminate the container by entering exit in the container console or by Docker stop or Docker kill. Background-type container: Background run, created after the start of the terminal regardless of the need to use Docker stop or Docker kill to terminate. First we create a run of an interactive container to try, in the container's console to simply output a "Hello,world", you can see that the starting speed is very fast. With Docker PS, you can view the running container and view all containers with Docker ps-a, including containers that are not started. (-L and-n=x can list the last created or X container)