I am quite new in nats and jetstream. I really appreciate any help :). My question is that how I can create a nats container with nondefault port which means not 4222. I was trying to create docker container for nats server with port 4222 like below:
docker pull nats:latest
docker run -d -p 4225:4225 nats -js
now the container is running with port 4225. Fine right? But I cannot connect to this nats server via powershell. As a simple example when I tried to create a subscription like below:
nats sub test
I got this:
nats: error: dial tcp 127.0.0.1:4222: i/o timeout
I am wondering why the terminal is trying to connect via 127.0.0.1:4222 and not 127.0.0.1:4225 ? Am I actually missing something?
It's almost a year late but I figured I'd reply in case someone else runs into this later.
For non-default ports pass
-pflag.e.g.
Now your docker command should be able to map host-port to container-port just fine with: