Document updated on Nov 2, 2018
When you want to restart KrakenD automatically after saving or changing files inside the configuration folder, the Docker image with the tag :watch
can do this automatically for you.
It works whether you use flexible configuration or a single file (krakend.json
or any other supported format).
The difference between the :watch
image and :latest
is that the KrakenD service wraps in a reflex watcher. When it detects that the configuration has changed, it restarts the service again, applying the changes. This behavior is very convenient while developing as it allows you to test new changes without manually restarting KrakenD back and forth.
:watch
Docker image is a development tool meant to speed up your initial KrakenD onboarding and testing, but it is not designed as a production tool. See below the risks of using :watch
in production.The :watch
tag is a regular KrakenD Docker container and accepts the same options and flags as its :latest
counterpart. Therefore, you should be able to replace :watch
with the desired tag (e.g: :
) in production without further changes.
The container expects you to mount the configuration as a volume mapped to /etc/krakend
. For instance:
$docker run --rm -v "$PWD:/etc/krakend" krakend/krakend-ee:watch
When you use flexible configuration, you can pass the environmental vars when starting the container. For instance:
$docker run --rm -it -v "$PWD:/etc/krakend" \
-e "FC_ENABLE=1" \
-e "FC_OUT=compiled.json" \
-e "FC_PARTIALS=/etc/krakend/partials" \
-e "FC_SETTINGS=/etc/krakend/settings" \
-e "FC_TEMPLATES=/etc/krakend/templates" \
krakend/krakend-ee:watch run -c krakend.tmpl
You can also integrate inside your IDE a watch to continuously check the configuration with the check
command instead of run
.
Because you might be tempted to use it in production, we don’t recommend it because:
The documentation is only a piece of the help you can get! Whether you are looking for Open Source or Enterprise support, see more support channels that can help you.