Server virtualization refers to the operating system and hardware to add a layer, called the hypervisor layer, the next control hardware, on the host operating system, operating system OS in file form, known as virtual machine, the main problem is the hardware utilization and flexibility of the problem, the common solution for VMware Vsphere,xen,kvm,hyper-v.. Container virtualization refers to the application of packaging in the OS to run in the form of processes, applications and applications are not completely isolated, but lighter, more efficient, LXC and Docker can be called container-level virtualization, the difference is that Docker can be understood as beautifully encapsulated by a more usable lxc, There is a better interface and more perfect matching.
If you compare Linux to traffic, Docker is like a car engine, Docker container is equivalent to every part of a car, Dockerfile is a car assembly workshop, Docker Registry can be regarded as a 4s shop.
1. Introduction of Docker Virtualization Technology
Docker is an open source application container engine that allows developers to package their apps and dependencies into a portable container, and then publish it to any popular Linux machine or virtualization. "Docker" should be one of the hottest technologies of the 2014, if you haven't heard of it, then you're out, and 2015 will start a new leap. The goal of the Docker project is to implement lightweight operating system virtualization solutions. Docker is based on the Linux container (LXC), Cgroup and other technologies.
2. Docker Virtual Installation Configuration
Docker Official document said that the requirements of Linux kernel at least 3.8, generally Centos7 or Ubuntu system, centos6.5 How to install it? To install the Docker software in the Centos6.x series, first close the SELinux and then install the corresponding Epel source.
3, Docker common command to explain
Everyone knows that to master Linux, the first thing is to be proficient in Linux commands, and to use it. And then today learning Docker virtualization is the same, we want to master Docker technology faster, we have to skilled docker what is commonly used commands, and what the meaning of each command, so as to lay the foundation for our learning behind.
4, Docker independent IP and container interconnection
Built-in Bridge (NAT) disadvantage: the need for supporting service registration/discovery, or host port allocation difficulties, easy to conflict. The way in which DNS is not available in the front-end routing layer Nginx Configuration (proxy_pass) is due to inconsistent ports exposed by each container. Port mappings are specified when the container is started and cannot be changed later. The test found that NAT does not support WebSocket. Self-built bridging network advantages: Each container has a separate IP, external services, such as Nginx+php,nginx+resin, can use the default 80 ports because the container exposed port can use 80 ports, so the front-end routing layer nginx configuration (proxy_ Pass) can be used in the way of DNS.
5, Docker use pipework to build independent extranet IP
Docker default provides an isolated intranet environment, starting with a DOCKER0 virtual network card, each container is connected to the DOCKER0 network card. The IP segment of DOCKER0 is 172.17.0.1, and if you want the container to be accessible to other machines on the same network segment as the host, you must map a port to the host's port when you start the Docker. So if everyone will find it troublesome, and not in the enterprise that use, weaker. We should know that the KVM Bridge network is very convenient, in fact, Docker is also more convenient, at least not from the bridge with the only, The last course we explained the Docker container under the centos6.5 of the implementation of the method, today we explain CENTOS7 if the rapid implementation of the Docker Container Bridge network, and for the container allocation of extranet IP.
6. Docker Build Tomcat Environment
Tomcat is a servlet container developed by the Apache Software Foundation's Jakarta Project, which enables support for servlet and JavaServer Page (JSP) in accordance with the technical specifications provided by Sun Microsystems. Tomcat itself is also an HTTP server that can be used alone, and Apache is an HTTP server written in C language. Tomcat is primarily used to parse JSP languages. The latest version is currently 8.0.
7, using Dockerfile for Docker container management
Dockerfile is a mirror representation that can be described by Dockerfile to describe the steps to build a mirror and automatically build a container. All Dockerfile command formats are: instruction arguments Although instructions ignore case, it is recommended that uppercase be used.
8, Dockerfile Enterprise case explanation and actual combat
Dockerfile is a mirror representation that can be described by Dockerfile to describe the steps to build a mirror and automatically build a container. All the Dockerfile command formats are: instruction arguments Although the instruction ignores case # author information Maintainer Jfedu.net # The Run command executes any command run yum install in the mirror specified above passwd OpenSSL openssh-server-y RUN echo ' 123456 ' | passwd--stdin root RUN sed-i '/^session\\s\\+required\\s\\+pam_loginuid.so/s/^/#/'/etc/pam.d/sshd
9, Docker Backup and disk expansion
The default space for the Docker container is 10G, and if you want to specify the size of the default container (specified when you start the container), you can specify it through the Dm.basesize parameter in the Docker configuration file, for example: docker-d--storage-opt dm.basesize =20g is to specify the default size of 20G, the specific parameters can refer to Https://github.com/docker/docker/tree/master/daemon/graphdriver/devmapper
10. Docker build MySQL database server
How do we build our MySQL database server in Docker virtualization? The answer is simple, we can be dockerfile to generate a MySQL image and start running.
11, Docker build nginx high-performance Web server
First need to install the Pcre library, and then install Nginx: #安装pcre支持rewrite库, can also install the source code, note * Installation source code, the designated Pcre path for the source of decompression path, rather than the path after the compilation, or will be an error (MAKE[1): * * */usr/ Local/pcre/makefile] Error 127 errors)
12, Docker build Lnamp architecture Configuration
Lnamp (linux+nginx+apache+mysql+php) architecture is favored by many IT companies to replace the LNMP (linux+nginx+mysql+php) architecture that was considered a good one, so what are the advantages of Lnamp? It's also about the pros and cons of Nginx and Apache. Nginx processing static file ability is very strong, Apache processing dynamic file is very strong and stable, the two integrated in a piece, performance improvement many times. Many Linux SAS may be engaged in lnmp, and will find some 502 errors in the PHP (FastCGI) pattern, due to the instability of the nginx+php (FastCGI) combination.
13, Docker automation script management
By learning this chapter, you can quickly manage your own containers, automate the installation and configuration of Docker virtualization and bridging networks, and use the pipework software to configure our container IP. Can implement a simple management of the container. #!/bin/bash #auto install Docker and Create VM #by wugk 2016-01-05
14, Docker automation script management two
The goal of the Docker project is to implement lightweight operating system virtualization solutions. Docker is based on technologies such as Linux containers (LXC). On the basis of LXC, the Docker is further packaged so that the user does not need to care about the management of the container, making the operation more convenient. The user operates a Docker container as simple as manipulating a fast, lightweight virtual machine. The following is a comparison between Docker and traditional virtualization (KVM, Xen, and so on, the container is virtualized at the operating system level, directly reusing the local host's operating system, and the traditional way is based on the hardware, virtual out of its own system, and then deploy the relevant app applications on the system.
Thank you for reading, I hope to help you, thank you for your support for this site!