MQTT mosquitto connection problem

NR 1.3.5
Node.js v12.21.0
Ubuntu 21.04

trying to connect mqtt in and mqtt out nodes
MQTT broker is running correctly (tested by MQTT Explorer : localhost:1883)
credentials are typed in properly
yellow dot on both nodes (IN and OUT)

seems Node Red can't reach the server (localhost)

any advice?

tks

Is the broker and node-red on the same server?

What version of mosquito are you running?

Yes same server
Mosquitto 2.0.10

Show us the settings on the mqtt config node

Is node-red installed using Docker? If not then how did you install it?

Yes Node-Red is installed using Docker. Node Red is working , I can reach using the server (localhost:1883) or by other client (IPAddress:1883). MQTT is running and tested by MQTT explorer installed into the server

Here the MQTT Explorer

You should always mention docker when asking questions on this forum. It is quite often the reason for issues and saves everyone some time going down the wrong path.

So, localhost to node-red is not gonna be localhost to mosquito. Node-reds localhost will be its own container (not where mosquito is running)

Is mosquito installed directly on the computer or in another docker container?

Either way, you will likely need to access mosquito via ip address AND since it is ver2 you will need to modify its config to permit external connection.

Ps, out of curiosity, why are you using docker? If you are not familiar with docker networking and volume persistence etc this can be more effort than it is worth.

Tks, now is clear.
So if an application is into a docker, localhost is the docker itself.... got it.
Mosquitto is not into a docker.

Actually, I use the docker installation because a lot of tutorials suggests to install in this way and I'm extremely new on Linux and Ubuntu so I'm trying to follow the online guides.

Tks so much, I'll try to configure Mosquitto to get external connection.

Resolved!!
Tks

Hi - any chance you can share those links ? so we can maybe try to get them corrected.

I installed Mosquitto on a spare Raspberry Pi3 and it has been running for years. Couldn't be simpler.