Home >Operation and Maintenance >Docker >What is the difference between docker and openvz
The difference between docker and openvz: When docker creates a container, it may need the help of some other containers and treats the container as an application and service, while openvz treats the container as a virtual server when creating a container. for vps.
The operating environment of this tutorial: linux7.3 system, docker-1.13.1 version, Dell G3 computer.
The views on containers are very different between the two.
In short OpenVZ treats containers as VPS, while docker treats containers as applications/services.
what does that mean? With OpenVZ, you can expect that when creating a container, it will be a bit like making a virtual server. OpenVZ's interface focuses on setting up your own VPS container by manually decorating it. So they provide templates for empty Linux machines that you can spin up and shut down, and then you can SSH into them to set them up yourself, just like a LAMP stack.
When you want to set up your LAMP stack, you do it just like you would when setting up a new server. You get an empty machine with a virtual ethernet adapter, it has its own publicly accessible WAN IP, has Ubuntu on it, access it with SSH, and you install all the required using your normal package manager (yum or apt) service, and then execute the settings required in its own configuration file.
With Docker, you can expect that when you create a container, the container is a single application that does only one thing. So it might need some other container to help it. (e.g. a container that provides a database) Docker makes it very easy to define what is inside a container without having to actually start the container and constantly create new identical instances of the container. They define the contents of a docker container (image) by using very lightweight templates called Dockerfiles.
There are already a bunch of dockerfiles out there that you can find at Docker Hub, take a look for yourself (like eating free candy in a candy store! :D): docker hub. The images generated by these dockerfiles can be extracted through the docker CLI tool using the dock command. In docker, there's also easy access to port forwarding, virtual directories (so that you can easily access files on the host), and stuff that any executable can use.
If you want to use LAMP stacking in docker, all you do is #34; docker run -d -p 80:80 tutum/lamp & #34;
This will pull the image tutum/lamp, then run daemonised (-d), port 80 is forwarded from the container to the host's port 80, exposing the internal web service to the outside. As you can see, compared to the OpenVZ machine, it does not have its own IP address. Just like the apache server it's running on your root machine. The advantage over native installation is that docker makes installation much easier and unlimitedly reproducible. Additionally, it does not clutter the host with tons of files and provides a security boundary for your application.
Recommended learning: "docker video tutorial"
The above is the detailed content of What is the difference between docker and openvz. For more information, please follow other related articles on the PHP Chinese website!