Have you ever know that your application can only run on your local computer but not on your friend's computer? In the end, that is because some libraries are missing.
Have you ever felt that it is hard for you to make your local environment is the same as the production? Just make sure the features are working in both.
You felt hard to try Nginx on your local computer to run your application because the operating system is Windows?
Docker can solve those problems. With Docker, you also can run multiple versions of MySQL, running lightweight Linux, isolating your application configurations, and many more.
Docker is a container. To make it easy to create, deploy, and run the application by using containers that can virtually run everywhere. It allows you to package up an application along with its libraries and configurations then ship it all out as one package.
There are four main objects in Docker; Image, Container, Volume, and Network. A Docker image is built up from a series of layers that represents an instruction in the image’s Dockerfile. You can see all Docker Images in Docker Hub.
There are two main files in Docker; Dockerfile and Compose file (default: docker-compose.yml). A Dockerfile is a text document that contains all the commands to assemble an image. The Compose file is a YAML file defining services, networks, and volumes. You can run your Compose file when you finished with
docker-compose up to start and
docker-compose down to stop in common. It is better to write a Compose file than doing a long CLI.
Docker vs Virtual Machine
Docker and Virtual Machines have some similarities. Both of them can run the operating system. But Docker can only run Linux. The main difference, Docker containers are executed with the Docker engine rather than a hypervisor. The benefit of containers, they are smaller and faster than virtual machines.
Pimcore 6 Environment
I just made a Docker image recently, Pimcore 6 Environment. Pimcore is an open-source CMS software built on PHP. This image is to help you start working with Pimcore 6 on Nginx and PHP 7.2. It comes with recommended configurations so you can focus on your application.
The Compose file example below.
version: '3' services: app: image: "aristorinjuang/pimcore6-environment" ports: - 80:80 volumes: - .:/var/www/project - ./project.conf:/etc/nginx/conf.d/project.conf