Deploying the LAMP Stack on Docker Containers
Before discussing Docker, we need to know about the concept of containers, which are extremely lightweight virtual machines (VMs). They are not intended to replace VMs but to complement them. Containers are like VMs, and they isolate the resources that an application has access to. The concept of a container is not new and has been around for a while—Solaris zones, FreeBSD jails and chroot are all containers. Containers are executed by container engines (the Docker engine in the case of Docker), and share the OS kernel and appropriate libraries. This advantage makes for significantly faster deployment with less overhead, easier migration and faster restart.
Docker uses cgroups and namespaces in the Linux kernel to provide resource isolation. Docker contains two components— the Docker engine and the Docker Hub. The Docker engine is the container virtualisation technology and Docker Hub is the SaaS service for sharing and managing Docker images in which the applications are stacked. Once Docker is installed and services are started, the Docker daemon is responsible for building, running and distributing the Docker containers. The Docker client interacts with the Docker daemon via sockets or through a RESTful API to do all the tasks.