mirror of
https://github.com/jpetazzo/container.training.git
synced 2026-02-14 17:49:59 +00:00
update section about restart condition
This commit is contained in:
@@ -3754,13 +3754,12 @@ The test message should show up in the logstash container logs.
|
||||
|
||||
- We're lucky: the parameters (`--log-driver` and `--log-opt`) are exactly the same!
|
||||
|
||||
- We will use the `--restart-condition` flag so that the container doesn't restart forever
|
||||
|
||||
.exercise[
|
||||
|
||||
- Send a test message:
|
||||
```bash
|
||||
docker service create --restart-condition none \
|
||||
docker service create \
|
||||
--log-driver gelf --log-opt gelf-address=udp://127.0.0.1:12201 \
|
||||
alpine echo hello
|
||||
```
|
||||
@@ -3769,6 +3768,31 @@ The test message should show up in the logstash container logs.
|
||||
|
||||
The test message should show up as well in the logstash container logs.
|
||||
|
||||
--
|
||||
|
||||
In fact, *multiple messages will show up, and continue to show up every few seconds!*
|
||||
|
||||
---
|
||||
|
||||
## Restart conditions
|
||||
|
||||
- By default, if a container exits (or is killed with `docker kill`, or runs out of memory ...),
|
||||
the Swarm will restart it (possibly on a different machine)
|
||||
|
||||
- This behavior can be changed by setting the *restart condition* parameter
|
||||
|
||||
.exercise[
|
||||
|
||||
- Change the restart condition so that Swarm doesn't try to restart our container forever:
|
||||
```bash
|
||||
docker service update `xxx` --restart-condition none
|
||||
```
|
||||
]
|
||||
|
||||
Available restart conditions are `none`, `any`, and `on-error`.
|
||||
|
||||
You can also set `--restart-delay`, `--restart-max-attempts`, and `--restart-window`.
|
||||
|
||||
---
|
||||
|
||||
## Connect to Kibana
|
||||
|
||||
Reference in New Issue
Block a user