Install with Docker
Keep the KubeMQ server you started with Docker: add a license key with docker run, Compose or Podman, check the license and remove it safely.
This page turns the server you started in Try KubeMQ into a licensed server you keep, using your own container commands. When you finish, kmq license reports that license adoption is accepted and durable and your data is unchanged. Time: about 10 minutes.
With Podman, use podman in place of docker in every command.
These commands are for bash on macOS and Linux. On Windows, run them in WSL (Windows Subsystem for Linux), or use the kmq tab of Try KubeMQ, which runs natively on Windows.
Before you start
Create a private folder, readable only by you, and work inside it:
mkdir -p -m 700 kubemq-privatecd kubemq-private- A server from Try KubeMQ, Docker tab. After the kmq tab, use Install with kmq. No server? See If something goes wrong.
- kmq, the KubeMQ command-line tool, installed as in Try KubeMQ.
- A trial key or a license key: see Plans compared.
Steps
Add your license
- Open the trial page.
- Choose Docker (1 server).
- Enter your work email, name and company; accept the trial terms .
- Enter the code KubeMQ emails you. The trial key arrives by email.
No email? Use Recover a trial key on the same page.
Or use the kmq trial steps on Install with kmq with "platform": "docker" in the request file, then run kmq license export --credential YOUR_LICENSE_REF --out license.key instead of saving the key below. Replace: YOUR_LICENSE_REF — the credential value that kmq trial claim printed.
Use the key from your KubeMQ order email.
Save the license key as license.key in this folder. The file holds only the key, on one line, with no quotes and no KUBEMQ_LICENSE_KEY= prefix. Then make it readable by you alone:
chmod 600 license.keyThis file is a secret. Do not commit it, paste it into chat, or attach it to a support ticket.
Write the key into a Docker environment file:
(umask 077; { printf 'KUBEMQ_LICENSE_KEY='; cat license.key; } > kubemq-license.env)Stop and remove the container; kubemq-data keeps the data:
docker stop kubemqdocker rm kubemqStart it again with the license:
docker run -d \ --pull always \ --platform linux/amd64 \ --name kubemq \ --hostname kubemq \ -p 127.0.0.1:50000:50000 \ -p 127.0.0.1:9090:9090 \ -p 127.0.0.1:8080:8080 \ -p 127.0.0.1:9092:9092 \ --env-file kubemq-license.env \ -e STORE_ENGINE=next \ -e STORE_NEXT_ACK_POLICY=strict \ -e STORE_STORE_PATH=/kubemq/store \ -e API_BIND_ADDRESS=0.0.0.0 \ -v kubemq-data:/kubemq/store \ europe-docker.pkg.dev/kubemq/images/kubemq-next:latestWith Podman:
podman run -d \ --pull always \ --platform linux/amd64 \ --name kubemq \ --hostname kubemq \ -p 127.0.0.1:50000:50000 \ -p 127.0.0.1:9090:9090 \ -p 127.0.0.1:8080:8080 \ -p 127.0.0.1:9092:9092 \ --env-file kubemq-license.env \ -e STORE_ENGINE=next \ -e STORE_NEXT_ACK_POLICY=strict \ -e STORE_STORE_PATH=/kubemq/store \ -e API_BIND_ADDRESS=0.0.0.0 \ -v kubemq-data:/kubemq/store \ europe-docker.pkg.dev/kubemq/images/kubemq-next:latestCheck that the server is running:
docker ps --filter name=kubemq --format '{{.Names}}: {{.Status}}'You should see:
HARNESS_OUTPUT_PENDINGCheck the license
If kmq has no saved connection to this server (you started it with the Docker command, not with kmq), sign in first:
kmq auth login --api-address http://127.0.0.1:8080 --context-name kubemq --username adminSelect the context saved by the login:
kmq context use kubemqkmq licenseYou should see:
{
"server_version": "...",
"adoption": {
"configured_input_sha256": "...",
"accepted_input_sha256": "...",
"state": "accepted",
"durable": true
},
"plan": "trial",
"mode": "online",
"source": "key",
"license_expires_at": "...",
"lease_expires_at": "...",
"run_until": "...",
"over_cap": false,
"stop_cause": null
}In the adoption object, state is accepted, durable is true, and the configured and accepted input hashes match. plan and license_expires_at match your license. stop_cause is null and over_cap is false. Other states: How licensing works. If kmq cannot connect, wait a few seconds and run it again.
Sign in at http://localhost:8080: the orders channel from Try KubeMQ is still there.
Use Docker Compose instead
Instead of step 1's start command, use Compose:
curl -fsSLO https://docs.kubemq.io/docker-compose.ymlTurn on its env_file line:
sed -i.bak 's|# env_file:|env_file:|' docker-compose.ymlThen:
docker compose pulldocker compose up -dCompose reuses kubemq-data; expect a warning that Compose did not create it. Check it:
docker compose psYou should see:
HARNESS_OUTPUT_PENDINGThen step 2.
Replace the license later
Run mv license.key license.key.old, save the new key, and repeat step 1 from the environment file on (with Compose, after the environment file, run docker compose up -d --force-recreate), then step 2. If the server does not start, restore the old key the same way; see Troubleshooting.
Remove the server
docker stop kubemq and docker rm kubemq, or docker compose down, keep the kubemq-data volume. Never run docker compose down -v.
Data loss: deleting the volume
This deletes every message, the administrator and the server's identity.
docker volume rm kubemq-dataIf something goes wrong
- Start with a trial key or license key. Do step 1 without stopping or removing a container, then step 2, then create the administrator at
http://localhost:8080. - A port is in use. Change the host side of its
-pflag, such as-p 127.0.0.1:18080:8080. For 8080, also runkmq license --endpoint http://127.0.0.1:18080. - The container stops at start.
docker logs kubemqends with a Troubleshooting link, for example#first-boot-bad-key(key refused) or#no-license-input(license env file missing). - Compose keeps restarting it after a licensing stop. Run
docker compose stop, fix the license, thendocker compose up -d.
Next steps
Was this page helpful?
Install with kmq
Keep the KubeMQ server you started with kmq: add a trial or license key, check the license, manage the server and keep kmq up to date.
Install on Kubernetes
Install the KubeMQ operator and a three-server cluster with kmq or Helm, add your license, check it, send a test message and connect your apps.