DEV Community

Ivan Karabadzhak
Ivan Karabadzhak

Posted on • Originally published at


Port 5000 is already in use macOS Monterey

After an update on my laptop, I got an issue. I have started the Docker container, but it fails. The port 5000 is already in use. Hmm, maybe another container took it. Ah, Airplay took it... Did you get the same issue? Let's fix it.

A long time ago, I started using 5000 ports for my projects. Usually, it is a web service. This is useful because you can't run many services on port 80. With port 5000, I can run containers with a web server, for example, on 5000, 5001, 5002, etc. This is easy to remember a thing. I started using it after some Flask (Python Framework) experience.

So, I started another container and got an error "Port 5000 is already in use". I checked my compose file and open ports and didn't understand the issue. After some research, I remembered about OS updates. Okay, catch you!

In macOS Monterey, Apple added the ability to use your Mac as an AirPlay device. For example, you can stream something from your iPhone to your MacBook.


Solution #1: This is stupid, but you could use a lot of other ports. For example, not I am using 6000 and other similar ports instead of 5000. Pros of this way are that you get AirPlay enabled on your Mac. There are a lot of open ports, but 5000 was like a habit (not a hobbit).

Solution #2: You could disable AirPlay. Go to System Preferences - Sharing. At the bottom, you will see the checkbox AirPlay Receiver. Disable it to make the port open.

Port 5000 is already in use in macOS Monterey

I prefer the first way because using AirPlay on my MacBook could be useful. Anyway, it's good to have a choice. I hope this small note was helpful to you.

By the way, I made a small note about how to remove the Skype icon from menubar on macOS. Would you like to check it?

Top comments (0)