0

Okay so I am fairly new to the whole Docker and Networks thing, so sorry in advance.

For the last week I experimented with Docker compose and got AdGuard and Jellyfin running and got Homer setup as a dashboard. Now I wanted to add Wireshark, but it gives me this error:

nging: [emerg] bind() to 0.0.0.0:3000 failed (98: Address in use)

I use my old MacBook Pro, Docker Desktop and have my stuff through docker compose files.
From what I've tried, finding out what lies on port 3000 and killing it, it's Docker Desktop itself.

My setup is the following:
I have all my stuff inside VSCode and started it via the docker compuse up -d command.
AdGuard compose file does say 3000:3000/tcp, but I changed it inside the AdGuardHome.yaml to 80, which works.
Homer uses 8080:8080 and Jellyfin the usual 8096:8096.
I tried to use ports 3030:3030 and 3031:3031 for Wireshark, but the log output stays the same with 3000.
I don't have anything setup on my router nor changed anything inside Docker Desktop.

Can someone help me, what I am doing wrong here? Do I need to change something. I don't get it.

EDIT:
Here is my docker compose for wireshark:

    ---
    version: "2.1"
    services:
      wireshark:
        image: lscr.io/linuxserver/wireshark:latest
        container_name: wireshark
        cap_add:
          - NET_ADMIN
        security_opt:
          - seccomp:unconfined #optional
        network_mode: host
        environment:
          - PUID=1000
          - PGID=1000
          - TZ=Europe/Berlin
        volumes:
          - mypath:/config
        ports:
          - 3030:3030 #optional
          - 3031:3031 #optional
        restart: unless-stopped
bennyyy999
  • 80
  • 1
  • 5

2 Answers2

1

Always try to run a docker-compose down.

  1. Check if port is in use,if so kill the process using that port:
sudo lsof -i -P -n | grep 3000

then:

 kill -9 <process id>
  1. Remove previous containers, try to get a clean build, so run this:
docker rm -f $(docker ps -aq)

NOTICE: that removes all images.

Extra: sometimes i had to restart my VM/PC in order to ensure ports are not opened.

jmvcollaborator
  • 2,141
  • 1
  • 6
  • 17
  • 1
    Its not really a good option to restart VM/PC instant of figuring out what is using the port, there are really a lot of options and neither will be needing a restart. for example , if you are using a system with busy 3000 port , you can change the container port to something else and map to what ever you feel comfortable with. – George Aug 17 '23 at 19:50
  • 1
    absolutely agree, it is just for sake of testing purposes, thanks for your comment @George – jmvcollaborator Aug 17 '23 at 19:51
0

You can Check with docker ps command to check which previous service is using the port and stop it.

One more thing to check is here , The official page of docker hub

It mention a docker compose example, And you have a mistake with yours. in the ports part

        ports:
          - 3030:3030 #optional
          - 3031:3031 #optional

You don't have control over the left side of the port, as this is pre configured by the image make that the container will work over port 3000 as mentioned.

so what you can change is the following :

        ports:
          - {whatever_port_you_want}:3000 #optional
          - {whatever_port_you_want}:3001 #optional

If you wanna change the internal port used by the container, There is an option at the official doc called CUSTOM_PORT, So setting this as environment variables will alter the 3000 default port to what ever you set.

George
  • 2,292
  • 2
  • 10
  • 21
  • Docker Desktop for MAC itself does not run on a port. It's a container running on a port. The container has an internal port (within the container) and you can map that to a port on the host. Mapping is done with "ports" on docker-compose as you described. – jmvcollaborator Aug 17 '23 at 19:49
  • oh, if there is specail handling for MAC then I will delete my answer, My entire idea that this will behave the same as Windows/Linux machine. – George Aug 17 '23 at 19:51
  • 1
    it is fine since the whatever_port_you want is the port on the Host, the other is the container internal port. – jmvcollaborator Aug 17 '23 at 19:53
  • nothing better than Makefile to make the build push pull docker images process smooth and reduce these kind of errors. – jmvcollaborator Aug 17 '23 at 19:59
  • 1
    Oh I see, the ```CUSTOM_PORT``` thing worked, I didn't see that, thank you! – bennyyy999 Aug 17 '23 at 20:17