NATS Docs
NATS.io
Twitter
Slack
GitHub
Search…
Welcome
Release Notes
What's New!
NATS Concepts
Overview
What is NATS
Subject-Based Messaging
Core NATS
JetStream
Subject Mapping and Traffic Shaping
NATS Service Infrastructure
Security
Connectivity
Using NATS
NATS Tools
Developing With NATS
Running a NATS service
Installing, running and deploying a NATS Server
NATS and Docker
Tutorial
Docker Swarm
Python and NGS Running in Docker
JetStream
NATS and Kubernetes
NATS Server Clients
Configuring NATS Server
Managing and Monitoring your NATS Server Infrastructure
Reference
FAQ
NATS Protocols
Legacy
STAN aka 'NATS Streaming'
nats-account-server
Powered By
GitBook
Python and NGS Running in Docker
Start a lightweight Docker container:
1
docker
run --entrypoint /bin/bash -it python:3.8-slim-buster
Copied!
Or you can also mount local creds via a volume:
1
docker
run --entrypoint /bin/bash -v
$HOME
/.nkeys/creds/synadia/NGS/:/creds -it python:3.8-slim-buster
Copied!
Install nats.py and dependencies to install nkeys:
1
apt-get
update
&&
apt-get
install
-y build-essential
curl
2
pip
install
asyncio-nats-client
[
nkeys
]
Copied!
Get the Python examples using curl:
1
curl
-o nats-pub.py -O -L https://raw.githubusercontent.com/nats-io/nats.py/master/examples/nats-pub/__main__.py
2
curl
-o nats-sub.py -O -L https://raw.githubusercontent.com/nats-io/nats.py/master/examples/nats-sub/__main__.py
Copied!
Create a subscription that lingers:
1
python nats-sub.py --creds /creds/NGS.creds -s tls://connect.ngs.global:4222 hello
&
Copied!
Publish a message:
1
python nats-pub.py --creds /creds/NGS.creds -s tls://connect.ngs.global:4222 hello -d world
Copied!
Previous
Docker Swarm
Next
JetStream
Last modified
5mo ago
Export as PDF
Copy link
Edit on GitHub