Closed the1gofer closed 2 years ago
I suspect a typo. The Mosquitto image has both ash
and sh
(as symlinks to busybox) but that really only matters if you need shell services.
In words:
-it
and no sh
is needed).If you can't replicate then there must be some explanation other than the mosquitto_password not being there because that command is still in my instance and I didn't do anything special.
Also, once you are running in an interactive shell inside the container, mosquitto mosquitto_password
will invoke "mosquitto" and pass it "mosquitto_password" etc as arguments. When I try that I get "Error: Unknown option 'mosquitto_passwd'." so, to me, that means mosquitto (the command) is unable to invoke mosquitto_passwd (another command).
I wonder if you're misunderstanding the command syntax. It's:
$ docker exec container command arguments
so, in something like:
$ docker exec mosquitto mosquitto -h
the first "mosquitto" is the container, the second "mosquitto" is the command to run inside the container, and "-h" is an argument to pass to that command running inside the container.
Make sense?
anything is possible, but I thought I was copy pasting. I went back and tried to add another one, and it worked. So I don't know. Thanks for your detailed response.
You're welcome. I did something similar the other day. The commands were still in my history file and they looked perfectly OK but, somehow, there was this problem in the space between the keyboard and the chair... 🤦♂️
the wiki says
when you use that command with the current image, you get
From what I gather whatever image that's based off doens't have bash. If you do
docker exec -it sh
. thenmosquitto mosquitto_passwd -b /mosquitto/pwfile/pwfile «username» «password»
it seems to work.