Elyra
Elyra The coding agent Elyra Conductor Local project conductor Elyra SQL Anywhere Replication-ready SQL engine
Release notes
Changelog
Elyra

Docker

SQL Anywhere does not publish a prebuilt container image — you build your own from source and run it like any other image. This page shows how to build the sqld server image, run it, and configure it.

Build the image

Clone the repository and build a Docker image (tagged sqlanywhere/sqld:latest here) from the included Dockerfile:

git clone https://github.com/kwhorne/sql-anywhere
cd sql-anywhere
docker build -t sqlanywhere/sqld:latest .

This produces a local image you can run directly. There is no registry to pull from — the image lives in your local Docker daemon (or your own registry if you choose to push it).

Launch a primary instance

docker run --name some-sqld -p 8080:8080 -ti \
    -e SQLD_NODE=primary \
    sqlanywhere/sqld:latest

Launch a replica instance

A replica needs SQLD_NODE=replica and the primary's gRPC URL:

docker run --name some-sqld-replica -p 8081:8080 -ti \
    -e SQLD_NODE=replica \
    -e SQLD_PRIMARY_URL=http://primary-host:5001 \
    sqlanywhere/sqld:latest

Data persistence

Database files are stored in /var/lib/sqld inside the image. To persist the database across runs, mount this location to a Docker volume or a bind mount:

# Bind mount a local path
docker run --name some-sqld -ti \
    -v $(pwd)/sqld-data:/var/lib/sqld \
    -e SQLD_NODE=primary \
    sqlanywhere/sqld:latest

# Or use a named volume
docker volume create sqld-data
docker run --name some-sqld -ti \
    -v sqld-data:/var/lib/sqld \
    -e SQLD_NODE=primary \
    sqlanywhere/sqld:latest

To store data in a different directory, set SQLD_DB_PATH accordingly:

docker run --name some-sqld -ti \
    -v sqld-data:/data/sqld \
    -e SQLD_NODE=primary \
    -e SQLD_DB_PATH=/data/sqld \
    sqlanywhere/sqld:latest

Authentication

SQLD_HTTP_AUTH

Legacy HTTP basic authentication. The argument must be in the format basic:$PARAM, where $PARAM is the base64-encoded string $USERNAME:$PASSWORD.

SQLD_AUTH_JWT_KEY_FILE

Path to a file with a JWT decoding key used to authenticate clients in the Hrana and HTTP APIs. The key is either a PKCS#8-encoded Ed25519 public key in PEM, or plain bytes of the Ed25519 public key in URL-safe base64. You can also pass the key directly in the SQLD_AUTH_JWT_KEY environment variable.

Environment variables

SQLD_NODE

default: primary

Configures the type of the launched instance: primary (default), replica, or standalone. Replica instances also need SQLD_PRIMARY_URL.

SQLD_PRIMARY_URL

The gRPC URL of the primary instance, required for replica instances.

SQLD_DB_PATH

default: iku.db

The location of the database file inside the container. A bare filename is placed in the default directory /var/lib/sqld.

SQLD_HTTP_LISTEN_ADDR

default: 0.0.0.0:8080

The HTTP listen address sqld serves on. Recommended to leave on the default port and remap at the container networking level.

SQLD_GRPC_LISTEN_ADDR

default: 0.0.0.0:5001

The gRPC listen address, used primarily for inter-node communication. Recommended to leave on the default.

Docker Compose

A simple Compose file for local development, using the image you built above:

services:
  db:
    image: sqlanywhere/sqld:latest
    ports:
      - "8080:8080"
      - "5001:5001"
    # environment:
    #   - SQLD_NODE=primary
    volumes:
      - ./data/sqlanywhere:/var/lib/sqld