Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
478 views
in Technique[技术] by (71.8m points)

linux - Error: Address in use 1883 mosquito Docker

Getting error on starting mosquito docker in ubuntu 16.04.

@biswanath:~$ docker logs mosquitto-test
1609346169: mosquitto version 1.6.12 starting
1609346169: Config loaded from /mosquitto/config/mosquitto.conf.
1609346169: Opening ipv4 listen socket on port 1883.
1609346169: Error: Address in use

Though I have uninstall all the previous installation of mousquitto. But Ports(1883) are still in use by mosquitto. Need help to free this port 1883.

@biswanath:~$ sudo lsof -i TCP:1883
COMMAND    PID USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
mosquitto 2185 root    4u  IPv4  27174      0t0  TCP *:1883 (LISTEN)
mosquitto 2185 root    5u  IPv6  27175      0t0  TCP *:1883 (LISTEN)

@biswanath:~$ sudo systemctl stop mosquitto
Failed to stop mosquitto.service: Unit mosquitto.service not loaded.

When tried to kill with kill -9 PID it recreate again.

@biswanath:~$ ps ax | grep mosq
13719 ?        Ss     0:00 /bin/sh /snap/mosquitto/387/launcher.sh
13759 ?        S      0:00 /snap/mosquitto/387/usr/sbin/mosquitto -c /snap/mosquitto/387/default_config.conf
14802 pts/2    S+     0:00 grep --color=auto mosq
@biswanath:~$ sudo kill -9 13719
@biswanath:~$ sudo killall -9 mosquitto
@biswanath:~$ ps ax | grep mosq
14931 ?        Ss     0:00 /bin/sh /snap/mosquitto/387/launcher.sh
14972 ?        S      0:00 /snap/mosquitto/387/usr/sbin/mosquitto -c /snap/mosquitto/387/default_config.conf
14978 pts/2    S+     0:00 grep --color=auto mosq

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

You just have another instance of Mosquitto already running.

Use ps ax | grep mosq to see if Mosquitto is still running outside of a container. If you find it, use sudo kill -9 PID where you replace PID with its process ID. Or you can try sudo killall -9 mosquitto.

If that doesn't solve the problem, check Docker.

Use docker ps to list all the Docker containers currently running.

Use docker stop ID where you replace the ID for each container that's running.

If you fail to find an instance of Mosquitto, reboot your computer and try again.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...