Docker Book: Difference between revisions
Jump to navigation
Jump to search
Line 15: | Line 15: | ||
* <code>docker run --rm php:7.4-apache-buster</code> | * <code>docker run --rm php:7.4-apache-buster</code> | ||
* <code>docker run --rm -it php:7.4-apache-buster bash</code> | * <code>docker run --rm -it php:7.4-apache-buster bash</code>, <code>php -v</code> | ||
Dockerfile: | Dockerfile: | ||
Line 25: | Line 25: | ||
<?php phpinfo(); | <?php phpinfo(); | ||
* <code>docker build -t phpinfo:latest .</code> | |||
* <code>docker run --rm -p 8000:80 phpinfo</code> | |||
* Visit localhost:8000 in browser |
Revision as of 10:07, 3 September 2020
Notes for upcoming book on Docker
Installing Docker
- Point to instructions on Docker website, no point in duplicating these
- Make sure you are running the latest version
Hello World
docker run --rm hello-world
- Include example output for checking
- Explain use of
--rm
flag - without this we end up with lots of stopped but not removed images
Basic PHP example
docker run --rm php:7.4-apache-buster
docker run --rm -it php:7.4-apache-buster bash
,php -v
Dockerfile:
FROM php:7.4-apache-buster COPY index.php /var/www/html/index.php
index.php:
<?php phpinfo();
docker build -t phpinfo:latest .
docker run --rm -p 8000:80 phpinfo
- Visit localhost:8000 in browser