PHP Docker deployment Starting application container

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Insert
> Step 2: And Like the video. BONUS: You can also share it!

Example

Once we have an image ready, we can start and serve the same. In order to create a container from the image, use

docker run -p 80:80 -d <Image name>

In the command above -p 80:80 would forward port 80 of your server to port 80 of the container. The flag -d tells that the container should run as background job. The final specifies which image should be used to build the container.

Checking container

In order to check running containers, simply use

docker ps

This will list out all the containers running on docker daemon.

Application logs

Logs are very important to debug the application. In order to check on them use

docker logs <Container id>


Got any PHP Question?