This is a typical Hello World for PHP in Docker.
Table of Content
git clone https://github.com/cleaniquecoders/docker-php-hello-world
Then navigate to directory and build the image:
cd docker-php-hello-world/
docker docker build -t hello-world .
t
argument used for tagging the image..
is the current directory build the image.
Typically we can run in two approach:
Now run the container:
docker run -it -p 80:80 hello-world
p
argument used for map exposed port in Docker container to the Host machine.it
argument used for output of the container is forwarded to our terminal.
Navigate to your browser now at localhost.
You may want to run Docker in background:
docker run -d -p 80:80 hello-world
docker ps
Will output the following:
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
1a77e445027b hello-world "docker-php-entrypoi…" 56 seconds ago Up 55 seconds 0.0.0.0:80->80/tcp angry_taussig
docker stop <container-id/name>