- Install docker
- Download example files: (
Dockerfile
,index.php
) - Run in terminal:
docker build . -t kaunasphp-example
docker run -p 8080:80 kaunasphp-example
This will build docker container named/tagged kaunasphp-example
.
Docker client will download all necessary files by the configuration in Dockerfile
.
.
is the name of current path where Dockerfile
exists.
Second line runs container (tagged as kaunasphp-example
) itself.
80
port is usually already used in many computers, so forwarding host 8080
port to container 80
.
After those commands you should see:
Hello from docker. PHP version: 7.2.11
when opened http://127.0.0.1:8080/ in a browser
docker ps
to list running containers