Docker containers in production
This document describes tuning and adaptions that is useful when running Vespa Docker containers in production.
Mounting persistent volumes for container nodes
The quick start guide
and AWS ECS multi node guide
show how to run Vespa in docker containers. In these examples all the data get stored inside the container. This means that the data is lost if the container is deleted. When running Vespa inside Docker containers in production, volume mappings should be added to persist data and logs.
Two directories have to be mounted when creating the container:
Example mounting directories from the Docker host in the container instance:
$ mkdir -p /tmp/vespa/var
$ export VESPA_VAR_STORAGE=/tmp/vespa/var
$ mkdir -p /tmp/vespa/logs
$ export VESPA_LOG_STORAGE=/tmp/vespa/logs
$ docker run --detach --name vespa --hostname vespa-container --privileged --volume $VESPA_VAR_STORAGE:/opt/vespa/var \
--volume $VESPA_LOG_STORAGE:/opt/vespa/logs --publish 8080:8080 vespaengine/vespa
System limits in docker containers
When Vespa starts inside Docker containers the startup scripts will set certain system limits.
Make sure that the environment starting the Docker engine is setup in such a way that these limits can be set inside the containers.
For a CentOS/RHEL base host Docker is usually started by systemd. In this case LimitNOFILE, LimitNPROC and LimitCORE should
be set to meet the minimum requirements in system limits.