Reputation: 127
I am new to NATS and decided to start playing with it using docker.
After pulling the official NATS image from docker hub (https://hub.docker.com/_/nats) I ran it as a container in detached mode using the following command:
docker container run --name my-nats -p 4222:4222 -d nats
Now if I want to access the NATS cli using the docker container exec
command, how do I do it?
I tried several different ways all resulting in errors:
Attempt 1:
docker exec -ti my-nats bash
resulted in the following error:
... starting container process caused: exec: "bash": executable file not found in $PATH: unknown
Attempt 2:
docker exec -ti my-nats sh
resulted in the following error:
... starting container process caused: exec: "sh": executable file not found in $PATH: unknown
Attempt 3:
docker exec -ti my-nats /bin/bash
resulted in the following error:
... starting container process caused: exec: "/bin/bash": stat /bin/bash: no such file or directory: unknown
Attempt 4:
docker exec -ti my-nats /bin/sh
resulted in the following error:
... starting container process caused: exec: "/bin/sh": stat /bin/sh: no such file or directory: unknown
I could not find a lot of information specific to the NATS cli, so I tried all these options I saw online regarding other apps. I guess NATS has a different command to open the cli, but I just could not find it. I even tried escaping the backslashes which resulted in more or less the same errors.
I would deeply appreciate any help or guidance with discovering a way to work it out and access my container's cli.
Upvotes: 5
Views: 4351