kibana/docs/setup/docker.asciidoc
James Rodewig 6aa5625343
[DOCS] Update Docker run instructions (#99340) (#99362)
Co-authored-by: Kaarina Tungseth <kaarina.tungseth@elastic.co>
# Conflicts:
#	docs/index.asciidoc
2021-05-05 08:55:28 -07:00

157 lines
4.6 KiB
Plaintext

[[docker]]
=== Install {kib} with Docker
++++
<titleabbrev>Install with Docker </titleabbrev>
++++
Docker images for Kibana are available from the Elastic Docker registry. The
base image is https://hub.docker.com/_/centos/[centos:7].
A list of all published Docker images and tags is available at
https://www.docker.elastic.co[www.docker.elastic.co]. The source code is in
https://github.com/elastic/dockerfiles/tree/{branch}/kibana[GitHub].
These images contain both free and subscription features.
<<managing-licenses,Start a 30-day trial>> to try out all of the features.
[float]
[[run-kibana-on-docker-for-dev]]
=== Run {kib} on Docker for development
ifeval::["{release-state}"=="unreleased"]
NOTE: No Docker images are currently available for {kib} {version}.
endif::[]
ifeval::["{release-state}"!="unreleased"]
To start an {es} container for development or testing, run:
[source,sh,subs="attributes"]
----
docker network create elastic
docker pull {es-docker-image}
docker run --name es01-test --net elastic -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node" {es-docker-image}
----
To start {kib} and connect it to your {es} container, run the following commands
in a new terminal session:
[source,sh,subs="attributes"]
----
docker pull {docker-image}
docker run --name kib01-test --net elastic -p 5601:5601 -e "ELASTICSEARCH_HOSTS=http://es01-test:9200" {docker-image}
----
To access {kib}, go to http://localhost:5601[http://localhost:5601].
[float]
=== Stop Docker containers
To stop your containers, run:
[source,sh]
----
docker stop es01-test
docker stop kib01-test
----
To remove the containers and their network, run:
[source,sh]
----
docker network rm elastic
docker rm es01-test
docker rm kib01-test
----
endif::[]
[float]
[[configuring-kibana-docker]]
=== Configure Kibana on Docker
The Docker images provide several methods for configuring Kibana. The
conventional approach is to provide a `kibana.yml` file as described in
{kibana-ref}/settings.html[Configuring Kibana], but it's also possible to use
environment variables to define settings.
[float]
[[bind-mount-config]]
==== Bind-mounted configuration
One way to configure Kibana on Docker is to provide `kibana.yml` via bind-mounting.
With +docker-compose+, the bind-mount can be specified like this:
["source","yaml",subs="attributes"]
--------------------------------------------
version: '2'
services:
kibana:
image: {docker-image}
volumes:
- ./kibana.yml:/usr/share/kibana/config/kibana.yml
--------------------------------------------
[float]
[[environment-variable-config]]
==== Environment variable configuration
Under Docker, {kib} can be configured via environment variables. When
the container starts, a helper process checks the environment for variables that
can be mapped to Kibana command-line arguments.
For compatibility with container orchestration systems, these
environment variables are written in all capitals, with underscores as
word separators. The helper translates these names to valid
{kib} setting names.
WARNING: All information that you include in environment variables is visible through the `ps` command, including sensitive information.
Some example translations are shown here:
.Example Docker Environment Variables
[horizontal]
**Environment Variable**:: **Kibana Setting**
`SERVER_NAME`:: `server.name`
`SERVER_BASEPATH`:: `server.basePath`
`MONITORING_ENABLED`:: `monitoring.enabled`
In general, any setting listed in <<settings>> can be
configured with this technique.
These variables can be set with +docker-compose+ like this:
["source","yaml",subs="attributes"]
----------------------------------------------------------
version: '2'
services:
kibana:
image: {docker-image}
environment:
SERVER_NAME: kibana.example.org
ELASTICSEARCH_HOSTS: http://elasticsearch.example.org
----------------------------------------------------------
Since environment variables are translated to CLI arguments, they take
precedence over settings configured in `kibana.yml`.
[float]
[[docker-defaults]]
==== Docker defaults
The following settings have different default values when using the Docker
images:
[horizontal]
`server.host`:: `"0"`
`elasticsearch.hosts`:: `http://elasticsearch:9200`
`monitoring.ui.container.elasticsearch.enabled`:: `true`
These settings are defined in the default `kibana.yml`. They can be overridden
with a <<bind-mount-config,custom `kibana.yml`>> or via
<<environment-variable-config,environment variables>>.
IMPORTANT: If replacing `kibana.yml` with a custom version, be sure to copy the
defaults to the custom file if you want to retain them. If not, they will
be "masked" by the new file.