Difference between Docker and OpenVZ

I am newbie to the world of virtualization. Can some one explain to me the differences between OpenVZ and Docker?

What could be good for the future?

Pros and cons?


The perspective on containers is very different between the 2.

In short OpenVZ sees a container as a VPS, and docker sees a container as an application/service.

What does this imply? For OpenVZ you can expect that when you create containers, its sort of like making Virtual Servers. OpenVZ has interfaces focussed on setting up VPS containers that you decorate yourself manually. Therefore they provide templates for empty linux machines that you can start up and shut down, that you afterward SSH into, to set them up yourself with whatever you need, like a LAMP stack.

When you would want to set up a LAMP stack, you would do it like you usually do when you set up a new server. You get an empty linux machine with a virtual ethernet adapter that has its own publicly accessible WAN IP with Ubuntu on it, access it with SSH, and you install all required services in it using your average package manager (yum or apt) and do the setup required in config files yourself.

For Docker, you can expect that when you create containers, the container is a single application, that just does ONE thing. Hence, it might need some other containers to help it. (For example a container that provides a database) Docker made it very easy to define whats inside a container without having to actually start one up, and constantly create new exactly equals instances of this container. They define the contents of a docker container (the image) by using very lightweight templates that they call Dockerfiles.

There is a huge set of dockerfiles already out there, that you can find in the Docker hub, take a look yourself (its like being in a candy shop with free candy! :D): docker hub. The images produced by these dockerfiles can be pulled with the docker CLI tool, by using a pull command. In docker theres also easy access to stuff like port forwarding, virtual directories (so that you can acces files on the host machine easily) and things alike that any executable could use.

If you would want a LAMP stack in docker, all you do is "docker run -d -p 80:80 tutum/lamp"

This pulls the image tutum/lamp, and runs daemonised (-d) it with port 80 from the container forwarded to the port 80 of the host, exposing the inner webservice to the outside. As you can see, it does not have its own IP address in contrast to an OpenVZ machine. And its just like its an apache server running on your root machine. The advantage compared to installing it natively, is that docker makes the installation a lot easier and unlimitedly replicable. Also it doesn't clutter your host machine with lots of files, and supplies a security boundary around your application.

Theres lots of features in most docker images, that are unique to it. For the tutum/lamp image, take a look here.

链接地址: http://www.djcxy.com/p/18204.html

上一篇: 你能用一个实际的例子/案例来解释Docker吗?

下一篇: Docker和OpenVZ的区别