NATS is an open-source, cloud-native messaging system. It provides a lightweight server that is written in the Go programming language.
$ docker run -it --name nats bitnami/nats
$ curl -LO https://raw.githubusercontent.com/bitnami/bitnami-docker-nats/master/docker-compose.yml
$ docker-compose up
- Bitnami closely tracks upstream source changes and promptly publishes new versions of this image using our automated systems.
- With Bitnami images the latest bug fixes and features are available as soon as possible.
- Bitnami containers, virtual machines and cloud images use the same components and configuration approach - making it easy to switch between formats based on your project needs.
- All our images are based on minideb a minimalist Debian based container image which gives you a small base container image and the familiarity of a leading linux distribution.
- Bitnami container images are released daily with the latest distribution packages available.
This CVE scan report contains a security report with all open CVEs. To get the list of actionable security issues, find the "latest" tag, click the vulnerability report link under the corresponding "Security scan" field and then select the "Only show fixable" filter on the next page.
Deploying Bitnami applications as Helm Charts is the easiest way to get started with our applications on Kubernetes. Read more about the installation in the Bitnami NATS Chart GitHub repository.
Bitnami containers can be used with Kubeapps for deployment and management of Helm Charts in clusters.
Non-root container images add an extra layer of security and are generally recommended for production environments. However, because they run as a non-root user, privileged tasks are typically off-limits. Learn more about non-root containers in our docs.
NOTE: Debian 8 images have been deprecated in favor of Debian 9 images. Bitnami will not longer publish new Docker images based on Debian 8.
Learn more about the Bitnami tagging policy and the difference between rolling tags and immutable tags in our documentation page.
1-rhel-7
,1.4.1-rhel-7-r11
(1/rhel-7/Dockerfile)1-ol-7
,1.4.1-ol-7-r9
(1/ol-7/Dockerfile)1-debian-9
,1.4.1-debian-9-r7
,1
,1.4.1
,1.4.1-r7
,latest
(1/debian-9/Dockerfile)
Subscribe to project updates by watching the bitnami/nats GitHub repo.
To run this application you need Docker Engine >= 1.10.0
. Docker Compose is recommended with a version 1.6.0
or later.
The recommended way to get the Bitnami NATS Docker Image is to pull the prebuilt image from the Docker Hub Registry.
$ docker pull bitnami/nats:latest
To use a specific version, you can pull a versioned tag. You can view the list of available versions in the Docker Hub Registry.
$ docker pull bitnami/nats:[TAG]
If you wish, you can also build the image yourself.
$ docker build -t bitnami/nats:latest https://github.com/bitnami/bitnami-docker-nginx.git
Using Docker container networking, a NATS server running inside a container can easily be accessed by your application containers using a NATS client.
Containers attached to the same network can communicate with each other using the container name as the hostname.
In this example, we will create a NATS client instance that will connect to the server instance that is running on the same docker network as the client.
$ docker network create app-tier --driver bridge
Use the --network app-tier
argument to the docker run
command to attach the NATS container to the app-tier
network.
$ docker run -d --name nats-server \
--network app-tier \
--publish 4222:4222 \
--publish 6222:6222 \
--publish 8222:8222 \
bitnami/nats:latest
You can create a small script which downloads, installs and uses the NATS Golang client.
There are some examples available to use that client. For instance, write the script below and save it as nats-pub.sh to use the publishing example:
#!/bin/bash
go get github.com/nats-io/go-nats
go build /go/src/github.com/nats-io/go-nats/examples/nats-pub.go
./nats-pub -s nats://nats-server:4222 "$1" "$2"
Then, you can use the script to create a client instance as shown below:
$ docker run -it --rm \
--network app-tier \
--volume /path/to/your/workspace:/go
golang ./nats-pub.sh foo bar
When not specified, Docker Compose automatically sets up a new network and attaches all deployed services to that network. However, we will explicitly define a new bridge
network named app-tier
. In this example we assume that you want to connect to the NATS server from your own custom application image which is identified in the following snippet by the service name myapp
.
version: '2'
networks:
app-tier:
driver: bridge
services:
nats:
image: 'bitnami/nats:latest'
ports:
- 4222:4222
- 6222:6222
- 8222:8222
networks:
- app-tier
myapp:
image: 'YOUR_APPLICATION_IMAGE'
networks:
- app-tier
IMPORTANT:
- Please update the
YOUR_APPLICATION_IMAGE
placeholder in the above snippet with your application image- In your application container, use the hostname
nats
to connect to the NATS server
Launch the containers using:
$ docker-compose up -d
The configuration can easily be setup by mounting your own configuration file on the directory /opt/bitnami/nats
:
docker run --name nats -v /path/to/gnatsd.conf:/opt/bitnami/nats/gnatsd.conf bitnami/nats:latest
After that, your configuration will be taken into account in the server's behaviour.
Using Docker Compose:
version: '2'
services:
nats:
image: bitnami/nats:latest
ports:
- '4222:4222'
- '6222:6222'
- '8222:8222'
volumes:
- /path/to/gnatsd.conf:/opt/bitnami/nats/gnatsd.conf
Find more information about how to create your own configuration file on this link
For further documentation, please check NATS documentation
We'd love for you to contribute to this container. You can request new features by creating an issue, or submit a pull request with your contribution.
If you encountered a problem running this container, you can file an issue. For us to provide better support, be sure to include the following information in your issue:
- Host OS and version
- Docker version (
docker version
) - Output of
docker info
- Version of this container
- The command you used to run the container, and any relevant output you saw (masking any sensitive information)
Copyright 2019 Bitnami
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.