Local Hosting

Docker

Create a local Splunk Observability Workshop container with Docker.

6 min

Docker Workshop Instance Setup

Overview

workshop-container.sh builds and starts an Ubuntu 24.04 container that runs a K3s cluster in Docker through k3d. The container installs the workshop tools and content, configures credentials obtained with a SWiPE ID, and waits until Kubernetes is ready before reporting success.

The script supports:

There is no SSH server in this container. The shell is docker exec.

Prerequisites

Run the script on a machine where the Docker engine is already running. The machine requires:

The container is privileged because k3d creates the cluster nodes as containers inside it. The script does not mount the host Docker socket. The Docker engine inside the container listens only on a local Unix socket.

Quick Start

Clone the workshop repository and run the script from local-hosting/docker:

bash
git clone https://github.com/splunk/observability-workshop
cd observability-workshop/local-hosting/docker
export SWIPE_ID='<swipe-id>'
./workshop-container.sh

SWIPE_ID is optional. When it is unset, the cluster still starts and workshop-secret is not applied.

The first run builds the image and creates the cluster. That takes several minutes. Keep the terminal attached until the log says:

text
Workshop cluster workshop-cluster is ready.

Pressing Ctrl+C stops following the log. The container keeps running.

Running ./workshop-container.sh again builds the image, then starts the existing workshop-k3d container if it is stopped. It does not replace a container that already exists. Deleting the container also drops the cluster: the node containers remain in the Docker volume, but the files they mount lived in the deleted container. The next run removes those leftover nodes and creates a new cluster. The volume still holds downloaded images, so that create does not download them again.

bash
docker rm -f workshop-k3d
./workshop-container.sh

Container specifications

PropertyValue
Imageworkshop-k3d
Container nameworkshop-k3d
Operating systemUbuntu 24.04 LTS (Noble)
Hostnameworkshop
Clusterworkshop-cluster: one k3d server and two agents
Node memory cap8G on the server and on each agent
Published ports81, 82, 9999, 443
Cluster imagesDocker volume workshop-k3d-docker, mounted at /var/lib/docker
Usersplunk
Shelldocker exec -it -u splunk workshop-k3d zsh

WORKSHOP_AGENTS and WORKSHOP_NODE_MEMORY override the cluster shape. WORKSHOP_AGENTS is a whole number from 0 to 10 and defaults to 2. WORKSHOP_NODE_MEMORY looks like 8G or 512M and defaults to 8G. Set them in the same shell that runs the script. A container that already exists keeps the cluster that was created for it. These variables apply when that cluster is created.

What the container installs

The image installs:

On first start, the container also:

The registry listens on port 9999. Workshop files and /var/log/syslog and /var/log/auth.log are mounted into the k3d nodes.

Startup progress and completion

The log reports these stages:

Success is the line Workshop cluster workshop-cluster is ready. The script then prints http://localhost:81 and the docker exec command.

Accessing the container

bash
docker exec -it -u splunk workshop-k3d zsh

The workshop site is:

text
http://localhost:81

Ports 82, 9999, and 443 are published on the same host ports.

Useful commands

Inside the container:

bash
# Check Kubernetes nodes
kubectl get nodes

# Inspect all workloads
kubectl get pods --all-namespaces

# Open the Kubernetes terminal interface
k9s

# View workshop materials
ls ~/workshop/

From the machine running Docker:

bash
# Follow the startup log
docker logs -f workshop-k3d

# Start a stopped container without rebuilding
docker start workshop-k3d

# Stop the container. Start it again with docker start or ./workshop-container.sh.
docker stop workshop-k3d

Environment variables

Set these in the shell that runs workshop-container.sh:

VariableDefaultPurpose
SWIPE_IDunsetWorkshop ID used to fetch tokens. When unset, workshop-secret is skipped.
WORKSHOP_AGENTS2Number of k3d agents, from 0 to 10.
WORKSHOP_NODE_MEMORY8GMemory cap for the server and for each agent.

Inside the container, a SWiPE response is exported under the field names returned by the API. The login environment also sets RUM_TOKEN from RUM, API_TOKEN from API, and both INGEST_TOKEN and ACCESS_TOKEN from INGEST. Those values are written to /home/splunk/.workshop-env and to workshop-secret. They are not stored in the image.

The container also sets:

The secret’s url is http://localhost:81.

Troubleshooting

bash
docker rm -f workshop-k3d
docker volume rm workshop-k3d-docker
./workshop-container.sh
Last Modified ·

Report an issue