Docker Php Application Example

Last Updated : 1 Oct 2026

We can run php application using docker. In the following steps, we are creating and running php application.

Create a directory to organize files by using following command.

See, screen shot of the above command.

Docker Php application 1

// index.php

// Dockefile

After that our project has two files like the below screen-shot.

Docker Php application 2

In the below screen-shot, we are creating docker image.

Docker Php application 3

Now look for the available images in the docker container.

Docker Php application 4

The above screen-shot shows that the created image php-app is available.

Now run the docker image. The following command is used to run docker images.

Docker Php application 5

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:

Docker Php application 6
  1. Create a directory
  2. Create a Php File
  3. Create a DockerFile
  4. Create Docker Image
  5. Run the Docker image