1
0
mirror of https://github.com/erlang/docker-erlang-example.git synced 2025-07-30 22:43:04 +03:00

Add init to all docker examples

This commit is contained in:
Lukas Larsson
2019-10-02 14:52:11 +02:00
parent c54e108bd0
commit 002926ad35
5 changed files with 8 additions and 5 deletions

View File

@ -135,13 +135,14 @@ For some more details of what this command does, see [README-CERTS.md](README-CE
We start the image in a docker container by issuing the following command.
$ docker run -d -p 8443:8443 --volume="$PWD/ssl:/etc/ssl/certs" --log-driver=syslog erlang-dockerwatch
$ docker run -d -p 8443:8443 --init --volume="$PWD/ssl:/etc/ssl/certs" --log-driver=syslog erlang-dockerwatch
870f979c5b4cdb7a1ba930b020043f50fa7457bf787237706fb27eefaf5fe61d
Let's parse some of the input.
* `-d`, starts the container in the background and prints the container ID.
* `-p 8443:8443`, exposes port `8443` from the container to our localhost.
* `--init`, use the tini initialization as PID 1 in order to prevent zombie processes.
* `--volume="$PWD/ssl:/etc/ssl/certs"`, mounts our local directory
(`$PWD/ssl`) with certificates to `/etc/ssl/certs` the container.
* `--log-driver=syslog`, will log all data from stdout in the container to our local syslog.

View File

@ -84,6 +84,7 @@ services:
dockerwatch:
build: .
image: dockerwatch
init: true
ports:
- "8443:8443"
logging:
@ -181,4 +182,4 @@ Start Kibana (configuration found in kibana/config/kibana.yml, $ELASTICSEACH_URL
Start dockerwatch application
docker run -p 8443:8443 --volume="$PWD/ssl:/etc/ssl/certs" --log-driver=gelf --log-opt gelf-address=udp://0.0.0.0:44622 dockerwatch
docker run -p 8443:8443 --init --volume="$PWD/ssl:/etc/ssl/certs" --log-driver=gelf --log-opt gelf-address=udp://0.0.0.0:44622 dockerwatch

View File

@ -1,8 +1,9 @@
version: "2"
version: "3.7"
services:
dockerwatch:
build: .
image: dockerwatch
init: true
ports:
- "8443:8443"
logging:

View File

@ -6,7 +6,7 @@ set -x
docker build -t logstash logstash/
docker run --name logstash -d -p 9600:9600 -p 44622:44622/udp logstash
docker build -t dockerwatch .
docker run --name dockerwatch -d -p 8443:8443 --volume="$PWD/ssl:/etc/ssl/certs" --log-driver=gelf --log-opt gelf-address=udp://0.0.0.0:44622 dockerwatch
docker run --name dockerwatch -d -p 8443:8443 --init --volume="$PWD/ssl:/etc/ssl/certs" --log-driver=gelf --log-opt gelf-address=udp://0.0.0.0:44622 dockerwatch
IP=$(docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' dockerwatch)
# Wait for logstash to finis startup
until curl -s 'localhost:9600/_node'; do sleep 5; echo "waiting for logstash to finish startup"; done

View File

@ -57,7 +57,7 @@ To forward log events (single line printouts to STDOUT) from the
docker-erlang-example image into the Logstash container, use the
`gelf` log driver and specify the UDP port number, for example:
docker run -p 8443:8443 --volume="$PWD/ssl:/etc/ssl/certs" --log-driver=gelf --log-opt gelf-address=udp://0.0.0.0:44622 dockerwatch
docker run -p 8443:8443 --init --volume="$PWD/ssl:/etc/ssl/certs" --log-driver=gelf --log-opt gelf-address=udp://0.0.0.0:44622 dockerwatch
In general, a single line printout from Erlang's Logger can for
instance be: