I have always heard that Docker is a great new thing, but I am not very interested until I encounter a real problem:If Docker is used for deploymentScout,Is it easier to do this?
I will explain it in three parts.
Wow, an effective way to simulate the production environment
There are 16 servers in the real production environment. If I try to simulate it using a virtual machine, it is better that each VirtualBox instance can have MB of memory. This memory requirement is twice the size of my notebook memory. In addition, VirtualBox has many restrictions, such as using a separate system kernel and file system. But these restrictions are not a problem for Docker. Docker containers shares the system of a host machine, or even the same program and library. It is no problem to run hundreds of ininers on a Docker host machine.
Old approaches
I can't simulate a completely real environment locally, but we just need to take a look at the time used to start a virtual machine:
$time vagrant upBringing machine 'default' up with 'virtualbox' provider...[default] Importing base box 'squeeze64-ruby193'......[default] Booting VM...[default] Waiting for VM to boot. This can take a few minutes....real 1m32.052s
It takes more than one minute and a half to start an image. What should I do if I want to modify the configuration? So I want to verify the feasibility. Does it have to be restarted? Another minute and a half.
This is a cruel punishment.
Use Docker
How lightweight is Docker?When you run a process in Docker iner, you may even forget that the process is not directly running on the host.In the following example, I run an image named "rails" in Docker container, where it is a Rails App (Dockerfile ):
root@precise64:~# docker run rails2013-08-26 20:21:14,600 CRIT Supervisor running as root (no user in config file)2013-08-26 20:21:14,603 WARN Included extra file "/srv/docker-rails/Supervisorfile" during parsing2013-08-26 20:21:14,736 INFO RPC interface 'supervisor' initialized2013-08-26 20:21:14,740 CRIT Server 'unix_http_server' running without any HTTP authentication checking2013-08-26 20:21:14,754 INFO supervisord started with pid 12013-08-26 20:21:15,783 INFO spawned: 'rails' with pid 102013-08-26 20:21:16,841 INFO success: rails entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
It takes only 2 seconds to start the container and the supervisor (which is responsible for starting the Rails app ).
In short, Docker is absolutely competent to virtualize a complete production environment on your development computer, and it is very fast. In this case, let's get started: I want to thoroughly test it.
Creating images is so convenient and fast-long cache!
Docker details: click here
Docker: click here
New virtualization options for the open-source project Docker and Red Hat
Dockerlite: lightweight Linux Virtualization
Detailed explanation of the entire process of building Gitlab CI for Docker
What is the difference between Docker and a normal Virtual Machine?
Docker will change everything