$touch counter.php
$nano counter.php
$git add counter.php
$git commit -m "get file"
$git log
$git remote add origin git@github.com:Andiswa1/visit-counter.git
$touch countlog.txt
$nano countlog.txt
$git add countlog.php
$git commit -m "get file"
$git log
$git remote add origin git@github.com:Andiswa1/visit-counter.git
$curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
$Add the Docker repository to APT sources:sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable
## Installed docker images following these steps:
$docker run hello-world
$docker search ubuntu
$docker pull ubuntu
$docker run ubuntu
$docker run -it ubuntu
$apt-get update
$apt-get install -y nodejs
$docker commit -m "What did you do to the image" -a "Author Name" container-id repository/new_image_name
$docker images
$docker ps
$docker ps -a
$docker ps -l
$docker stop container-id
$docker login -u docker-registry-username
$docker push docker-registry-username/docker-image-name
Two core concepts are conveyed in the vanilla example: 1) how to build your own docker from Dockerfile, and 2) how to mount a volume inside of a docker.
chmod a+w scripts/countlog.txt
docker build -t zenlab/visit-counter .
## run with docker image built from Dockerfile
docker run --rm \
-p 80:80 \
--name visit-counter \
zenlab/visit-counter
docker run --rm \
-p 80:80 \
--name visit-counter \
zenlab/visit-counter
docker run --rm \
-p 80:80 \
--name php \
-v "$PWD/scripts":/var/www/html \
php:7.0-apache
docker run --rm \
-p 80:80 \
--name visit-counter \
-v "$PWD/scripts":/var/www/html \
zenlab/visit-counter
http://localhost/counter.php
or
http://localhost/php.info
Code adapted from http://justintadlock.com/web-design/counter
Docker image extended from https://hub.docker.com/_/php/