Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
56 lines (51 sloc) 2.92 KB
---
# Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
title: "Docker Containers in Production"
---
<p>
This document describes tuning and adaptions that is useful when running Vespa Docker containers in production.
</p>
<h2 id="persistent-container-volumes">Mounting persistent volumes for container nodes</h2>
The <a href="vespa-quick-start.html">quick start guide</a> and <a href="vespa-quick-start-multinode-aws-ecs.html">AWS ECS multi node guide</a> 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.
<br/><br/>
<strong>Two directories have to be mounted when creating the container:</strong>
<ul>
<li>/opt/vespa/var</li>
<li>/opt/vespa/logs</li>
</ul>
<strong>Example mounting directories from the Docker host in the container instance:</strong>
<pre>
$ 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
</pre>
<h2 id="system-limits-in-containers">System limits in docker containers</h2>
<p>
When Vespa starts inside Docker containers the startup scripts will set certain <a href="reference/files-processes-and-ports.html#vespa-system-limits">system limits</a>.
</p>
<p>
Make sure that the environment starting the Docker engine is setup in such a way that these limits can be set inside the containers.
</p>
<p>
For a CentOS/RHEL base host Docker is usually started by <a href="https://www.freedesktop.org/software/systemd/man/systemd.exec.html">systemd</a>. In this case LimitNOFILE, LimitNPROC and LimitCORE should
be set to meet the minimum requirements in <a href="reference/files-processes-and-ports.html#vespa-system-limits">system limits</a>.
</p>
<h2 id="controlling-which-services-to-start">Controlling which services to start</h2>
<p>
The docker image vespaengine/vespa can take a command that controls which services are started inside the container.
</p>
<strong>Starting a configserver container:</strong>
<pre>
$ docker run &lt;other arguments&gt; --env VESPA_CONFIGSERVERS=&lt;comma separated list of config servers&gt; vespaengine/vespa configserver
</pre>
<strong>Starting a services container (configserver will not be started):</strong>
<pre>
$ docker run &lt;other arguments&gt; --env VESPA_CONFIGSERVERS=&lt;comma separated list of config servers&gt; vespaengine/vespa services
</pre>
<p>
Omitting the command will result in both the configserver and services being started. The VESPA_CONFIGSERVERS environment variable will then be set to the local host.
</p>
</h2>