Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
| ... | ... |
@@ -591,6 +591,17 @@ To examine the result further, you can use `docker exec`: |
| 591 | 591 |
|
| 592 | 592 |
And you can gracefully request `top` to shut down using `docker stop test`. |
| 593 | 593 |
|
| 594 |
+The following `Dockerfile` shows using the `ENTRYPOINT` to run Apache in the |
|
| 595 |
+foreground (i.e., as `PID 1`): |
|
| 596 |
+ |
|
| 597 |
+``` |
|
| 598 |
+FROM debian:stable |
|
| 599 |
+RUN apt-get update && apt-get install -y --force-yes apache2 |
|
| 600 |
+EXPOSE 80 443 |
|
| 601 |
+VOLUME ["/var/www", "/var/log/apache2", "/etc/apache2"] |
|
| 602 |
+ENTRYPOINT ["/usr/sbin/apache2ctl", "-D", "FOREGROUND"] |
|
| 603 |
+``` |
|
| 604 |
+ |
|
| 594 | 605 |
If you need to write a starter script for a single executable, you can ensure that |
| 595 | 606 |
the final executable receives the Unix signals by using `exec` and `gosu` |
| 596 | 607 |
(see [the Dockerfile best practices](/articles/dockerfile_best-practices/#entrypoint) |