:docker-version-tag: bleeding
ifeval::["{prerelease}" == "false"]
:docker-version-tag: {full-display-version}
endif::[]

.Create a project directory for {page-component-title} Core and create a `docker-compose.yml` file.
[source, console]
----
mkdir horizon
cd horizon
vi docker-compose.yml
----

[source, docker-compose.yml]
[subs="verbatim,attributes"]
----
---
version: '3'

volumes:<1>
  data-opennms: {}
  data-config: {}

services:
  horizon:<2>
    image: opennms/horizon:{full-display-version}<3>
    container_name: horizon
    environment:
      TZ: 'America/New_York'<4>
      POSTGRES_HOST: 'my-database-host'<5>
      POSTGRES_PORT: 5432
      POSTGRES_USER: 'postgres'
      POSTGRES_PASSWORD: 'my-postgres-password'
      OPENNMS_DBNAME: 'opennms-core-db'
      OPENNMS_DBUSER: 'opennms'
      OPENNMS_DBPASS: 'my-opennms-db-password'
    volumes:<6>
      - data-opennms:/opennms-data
      - data-config:/opt/opennms/etc
    command: ["-s"]
    ports:<7>
      - '8980:8980/tcp'
      - '8101:8101/tcp'
    healthcheck:
      test: [ 'CMD', 'curl', '-f', '-I', 'http://localhost:8980/opennms/login.jsp' ]<8>
      interval: 1m
      timeout: 5s
      retries: 3
----

<1> Volume definitions to persist the {page-component-title} Core data and configuration files.
<2> The {page-component-title} Core instance service is named `horizon` with a friendly `container_name`.
<3> Image reference using the {page-component-title} container image with the Core services.
<4> Set the time zone and the postgres credentials to initialize the database that the {page-component-title} Core instance uses. To list all available time zones, use `timedatectl list-timezones`.
<5> Set the host or IP address of the host that runs the PostgreSQL database.
<6> Mount directories to store RRD files, PDF reports, and configuration files in a persistent volume.
<7> Publish ports to access the web UI and the Karaf shell.
<8> Run an internal health check against the web UI to verify service health status.

NOTE: The process inside the container runs as a non-privileged user with user id `10001`.
     If you want the configuration files in a bind mount on your local host system, make sure you set permissions and ownership accordingly with `chown 10001:10001 ./path/to/my/config-dir`.

TIP: To run a release candidate or a different version, use the public image tags from our repository on <<link:https://hub.docker.com/repository/docker/opennms/horizon/tags, DockerHub>>.

.Validate your Docker Compose file
[source, console]
----
docker compose config -q
----
