roustabout
It is a lightweight, portable and isolated container, and an engine that can easily build, transmit and run applications in the container. Unlike traditional virtualization technology, Docker.
The engine does not virtualize the virtual machine, but directly uses the kernel and hardware of the host and directly runs the applications in the container on the host. That's why, dockers.
The performance gap between the application running in the container and the application running on the host is almost negligible. But Docker itself is not a container system, but a tool to create a virtual environment based on the original containerization tool LXC. Tools like LXC have been used in production environment for many years, and Docker provides more friendly image management tools and deployment tools on this basis.
Docker is not a virtualization engine.
When Docker was first released, many people took Docker and virtual machines VMware, KVM and VirtualBox.
Compare it. Although Docker and virtualization technology are dedicated to solving similar problems from a functional point of view, Docker
But in a completely different way. A virtual machine is a set of virtual hardware, and the disk operation performed by the system of the virtual machine is actually operating on the virtual disk. When running CPU
The intensive task is that the virtual machine puts the CPU in the virtual system.
Instructions "translate" the CPU instructions of the host and execute them. The memory consumed by two disk tiers, two processor schedulers and two operating systems will bring considerable performance loss. A virtual machine consumes hardware resources equivalent to the corresponding hardware, and a host will be overloaded if it runs too many virtual machines. but
Docker doesn't have this concern. Docker runs applications in a "container" solution: using namespaces and CGroup.
Limit resources, share the kernel with the host * * *, and do not use virtual disks. All container disk operations are actually /var/lib/docker/
The operation of. In short, Docker is actually just running a restricted application in the host.
It is not difficult to see from the above that the concepts of container and virtual machine are different, and containers cannot replace virtual machines. Where the container can't reach, the virtual machine can show its talents. For example, the host is
Linux can only run Windows through a virtual machine, but Docker can't. For another example, the host is Windows, and Windows cannot run directly.
Docker, Docker on Windows actually runs on the VirtualBox virtual machine.
Docker uses a hierarchical file system
As mentioned above, compared with the existing container technology LXC, one of the advantages of Docker is that Docker provides mirror management. roustabout
Generally speaking, a mirror is a static read-only snapshot of a container file system. But not only that, dockers
All disk operations in are performed on a specific copy-on-write file system. Let's illustrate this problem through an example.
For example, if we want to build a container to run JAVA Web applications, then we should use an image with JAVA installed. exist
In Dockerfile (instruction file for generating images), you should specify "JAVA-based images" so that Docker will go to Docker Hub.
Download the pre-built JAVA image from the registry. Then specify to download and extract Apache Tomcat software to /opt/tomcat in Dockerfile.
In the folder. This command will not have any impact on the original JAVA image, but only adds a change layer to the original image. When a container is started, all change layers in the container will be started, and the container will run /usr/bin/java from the first layer.
Command and call /opt/tomcat/bin in another layer.
Orders. In fact, every instruction in Dockerfile will create a new change layer, even if only one file is changed. If you have used Git,
You can understand this more clearly. Every instruction seems to leave a record every time mit. But for Docker,
Generally speaking, this file system provides greater flexibility and makes it easier to manage applications.
Our spanning tree team has a self-maintained image that contains Tomcat. Releasing a new version is also simple: use Dockerfile.
Copy the new version into the mirror to create a new mirror, and then mark the new mirror with the version. The difference between different versions of the image is only 90 MB.
Files, which are based on the same master image. If you use virtual machines to maintain these different versions, you will consume many different disks to store the same system, and use Docker instead.
Only a small amount of disk space is needed. Even if we run many instances of this image at the same time, we only need a basic JAVA/TOMCAT image.
Docker can save time.
Many years ago, when I was developing software for a chain restaurant, I had to write a 12 page Word document to describe how to build an environment. Such as local Oracle
Database, specific version
JAVA, and other 7788 system tools and * * * libraries and software packages. The whole construction process wasted almost one day for everyone in our team. If measured by money, it cost us tens of thousands of dollars. Although customers are used to this kind of thing, and even think that it is necessary to introduce new members, let members adapt to the environment and let employees adapt to our software, in contrast, we would rather spend more time building functions for customers that can enhance our business.
If Docker exists, the build environment will be like using the automated build tool Puppet/Chef/Salt/Ansible.
As simple as that, we can also shorten the whole construction period from one day to a few minutes. But unlike these tools, Docker.
You can not only build the whole environment, but also save the whole environment as a disk file and copy it to other places. Do you need to compile Node.js from the source code? roustabout
I can do it. Docker can not only build the Node.js environment, but also mirror the whole environment and save it anywhere. Of course, because Docker
Is a container, so don't worry about what the execution in the container will have on the host.
Now the new members of our team just need to run docker-pose up.
Commander, you can have a cup of coffee and get to work.
Docker can save money.
Of course, time is money. In addition to time, Docker can also save money on infrastructure hardware. Research by Gartner and McKinsey shows that the utilization rate of data centers is 6%—
About 12%. Moreover, if you use virtual machines, you need to passively monitor and set the CPU hard disk and memory usage of each virtual machine, because static partitions are used.
Partition) so resources are not fully utilized. . Containers can solve this problem: containers can share memory and disks between instances. You can run multiple services on the same host without limiting the resources consumed by the container. You can limit the resources, stop the container when it is not needed, and start the stopped program without worrying about excessive resource consumption. Only a few people will visit your website at 3 am, and you need more resources to perform batch processing tasks at night, so you can easily exchange resources.
The memory, hard disk and CPU consumed by the virtual machine are fixed, so the general dynamic adjustment needs to restart the virtual machine. With Docker, you can limit resources, thanks to
CGroup, it is very convenient to dynamically adjust the resource limit, so there is no need to limit resources. roustabout
The applications in the container are just two isolated applications to the host, not two virtual machines, so the host can also allocate resources by itself.
Docker has a powerful mirror hosting system.
As mentioned earlier, this hosting system is called Docker Hub Registry. By April 29th, 20 15, there will be 14000 on the Internet.
A public Docker, and most of them are hosted on Docker Hub. Like Github Docker, which has largely become a representative of open source projects.
The official Docker Hub is already the representative of the public Docker image. These images can be used as the basis for your applications and data services.
Thanks to this, you can try the latest technology at will: maybe some people package instances of graphics databases into Docker images and host them. Another example.
Gitlab, it is very difficult to build Gitlab by hand. Translators are not recommended for ordinary users to build by hand, but if you use Docker,
Gitlab, this image will be created in five seconds. Another example is a specific Ruby version of a Rails application, and another example is. NET application on Linux.
Applications can be built with a simple Docker command.
Docker official pictures have official labels, and security can be guaranteed. However, the security of the third-party image cannot be guaranteed. Please download the third-party image carefully. In a production environment, you can only use Dockerfile provided by a third party to build an image.
Docker Github introduction: get a Gitlab in 5 seconds.
Yes. NET application and Rails application on Linux will be introduced in detail in future articles.
Docker can avoid bugs.
Spanning tree has always been an "unchangeable infrastructure".
Infrastructure) enthusiasts. In other words, unless there are loopholes such as heart bleeding, we try not to upgrade the system and try not to change the system settings. When adding a new server, we will also build the server system from scratch, then directly import the image, put the server into a load-balanced cluster, and then carry out a health check on the server to be retired before removing the cluster. Benefit from
Docker images can be easily imported and exported. We can minimize incompatibilities caused by environment and version problems, and even if there are incompatibilities, we can easily roll them back. Of course there is.
Docker, our operating environment in production, testing and development is unified. In the past, in collaborative development, "it works on my computer, but it doesn't work on your computer" because the computers developed by everyone have different configurations. now
Docker has helped us solve this problem.
Docker can only run on Linux at present
As mentioned earlier, the technology used by Docker has been tested in production environment for a long time. Although these technologies have existed for a long time, most of them are still Linux.
Unique, such as LXC and Cgroup. In other words, so far, Docker container can only run Linux on Linux.
Services and applications on. Microsoft is working closely with Docker and announced that the next version of Windows Server will support it.
Docker container, and named it Windows Docker, it is estimated that the technology adopted should be Hyper-V.
Container, we expect to see this version in the next few years.
Docker is a platform for developers and system administrators to develop, migrate and run applications. After the application is packaged into DockerImage through Docker, it can be downloaded, started, expanded, deleted and migrated uniformly, which facilitates the deployment and operation of the application. This article will introduce how to deploy Docker environment on different operating system platforms. Information Ubuntu:Docker only supported Ubuntu when it was first launched, and then began to support other platforms bit by bit. So it is quite simple to deploy Docker platform on Ubuntu platform. At present, the official versions supported are UbuntuTrusty 14.04(LTS), Ubuntu Precision12.04 (LTS) and UbuntuSaucy 13. 10. Docker requires a 64-bit system with a kernel version of at least 3. 10 (if it is Ubuntu 12.04LTS, it requires a kernel version of at least 3. 13). Uname–r command can be used to confirm the kernel version of the current system: $ uname-r 3.11.0-1 The following commands of 5-generic can be used to upgrade the kernel: $ sudoapt-getupdate $ sudoapt-getinstallinux-image-generic-lts-trusty $ sudoreboot. After that, you can install Docker: $ wget-qo-/boot2docker/OSX-installer/releases/latest. After the installation is completed, Boot2Docker is located in the Applications folder. Note: Boot2Docker is currently only released as a development tool. Please do not apply it in a production environment. Create a Boot2Docker virtual machine: $ boot2docker init $ boot2docker start $ boot2docker shelinit displays or sets the environment variable $ boot2docker shelinit $ eval "$ (boot2docker R shelinit), "Finally verify whether the installation is successful: $ docker hello-world Windows: Windows, like MACOS, needs to install the Boot2Docker tool. The installation file can be obtained from/boot2docker/Windows-installer/releases/latest. Windows version of Boot2Docker will automatically confirm the environment variables when it is started, so it can directly verify whether the installation is successful: $ dockerrunhello-world.
Can the test environment and production environment be converted to each other? Do you divide etl tasks into test environment and production environment? How to switch between them?
Generally divided into development, testing, uat and production environment. If you switch, please export the resource library before importing.
How to copy a production environment to a test environment using mirroring? Usually, enterprises do not import data directly, but copy the whole production environment as a test environment to ensure that the configuration of the test environment is the same as that of the formal system.
At present, there are usually three sets of test environment planning: joint debugging test environment, functional test environment and quasi-release environment. In order to get closer to the real environment of users, for example, some real data may be used to test the software. At this point, the key use cases should be important business processes, the most commonly used functions of users, the newly added functions and the functions that have the greatest impact on the interests of the company.
Running environment and test environment The running environment is the condition for a computer to support software. For example, some old games can only run under DOS, which means that the running environment of the game is DOS.
The same test environment is a condition that can support software testing.
The development environment is usually the same as the personal test environment. Because usually you use the same computer.
Specifically, I develop a website.
Development environment: windows
tomcat
jdk
Is there any enterprise in docker swarm that uses the production environment? Docker Swarm is an officially released cluster container management tool. Its characteristics are: lightweight, seamless support for standard docker API. In short, the article Swarm clearly explains its architecture and commands. This paper builds and manages a swarm cluster from scratch.
Preparatory work/about to start work
We need to install virtualBox and Vagrant first. Constructing virtual test environment with vagger driving virtualBox. First, create an empty folder in any local path, such as test, and run the following command:
virtual server
Mkdir test
Cd test
Wanderer initialization minimum /ubuntu-trusty64-docker
Vi wandering files
There should be a sentence config.vm.box = "minimum/Ubuntu-trusty64-docker". Adding the following lines of code below it is equivalent to assigning it three virtual machines, one is called manager, and its IP is192.168.33.17; The other two are called node 1 and node2, and their IPs are192.168.33.18 and192.168.33.19 respectively.
Wandering file
config . VM . define " manager " do | host |
host.vm.hostname = "manager "
host.vm.neork "private_neork ",IP:" 192. 168.33 . 17 "
end
config . VM . define " node 1 " do | host |
host.vm.hostname = "node 1 "
host.vm.neork "private_neork ",IP:" 192. 168.33 . 18 "
end
config . VM . define " node 2 " do | host |
Host.vm.hostname = "node2 "
host.vm.neork "private_neork ",IP:" 192. 168.33 . 19 "
end
This tramp image has helped us install docker on the basis of ubuntu, which is very convenient to use. Then run the following command on three terminals to start and connect three virtual machines.
Virtual box host terminal 1
Wander
Wandering ssh manager
Virtual box host terminal 2
Wandering ssh node 1
Virtual box host terminal 3
Wandering ssh node 2
Create an environment
In order for swarm to manage nodes, the docker daemon must first support TCP. Run the following command on three virtual machines:
Manager and node 1 and node 2
sudo sh-c ' echo DOCKER _ OPTS = \ "-H TCP:0 . 0 . 0 . 0:2375-H UNIX:/var/run/DOCKER . sock \ " & gt; & gt/etc/default/docker '
Sudorum/etc/docker/key.json # If the docker id generated by the tramp is the same, deleting and restarting the docker service will automatically generate a new one.
Sudo service docker restart
What can environmental monitoring major do? First of all, you can do environmental monitoring in the environmental monitoring station of * * * *, then you can be a technician in the environmental management company (which can be environmental monitoring or other work), and you can also do instrument design, instrument inspection, instrument application, instrument after-sales, instrument consultation and instrument sales in the instrument company, and you can also be a chemist in the evolution factory.
What is the difference between building a windinws test environment and a linux test environment? I don't understand what you want. If it is an application test environment, just install the linux system and deploy the application. If it is a test database, install the database software.