We can run php application using docker. In the following steps, we are creating and running php application.
- Create a directory Create a directory to organize files by using following command.
- Create a Php File index.php
- Create a DockerFile Dockefile
- Create Docker Image
- Run the Docker image Now run the docker image. The following command is used to run docker images.
See, screen shot of the above command.
After that our project has two files like the below screen-shot.
In the below screen-shot, we are creating docker image.
Now look for the available images in the docker container.
The above screen-shot shows that the created image php-app is available.
We can see that our docker image is running and output is shown to the browser. This image is running on the 172.17.0.2 ip.
Output:
Reference: