Skip to content

Instantly share code, notes, and snippets.

@ipanardian
Created September 30, 2025 05:01
Show Gist options
  • Select an option

  • Save ipanardian/c2f1d114eb61fe36baca34f9aafc074c to your computer and use it in GitHub Desktop.

Select an option

Save ipanardian/c2f1d114eb61fe36baca34f9aafc074c to your computer and use it in GitHub Desktop.
NATS Core Docker Compose (single)
NATS_USER=
NATS_PASSWORD=
services:
nats:
image: nats:2.10-alpine
container_name: nats-dev
ports:
- "4222:4222"
- "8222:8222"
env_file:
- .env
volumes:
- ./config/nats.conf:/etc/nats/nats-server.conf:ro
- nats-dev-data:/data
command: ["-c", "/etc/nats/nats-server.conf"]
restart: unless-stopped
healthcheck:
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:8222/healthz"]
interval: 10s
timeout: 5s
retries: 3
start_period: 5s
logging:
driver: "json-file"
options:
max-size: "50m"
max-file: "3"
volumes:
nats-dev-data:
server_name: nats-dev
port: 4222
http: 0.0.0.0:8222
authorization {
users = [
{ user: $NATS_USER, password: $NATS_PASSWORD, permission: { publish: ">", subscribe: ">" } }
]
}
logtime: true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment