Docker Community Forums

Share and learn in the Docker community.

Accessing host network (and devices on network) from within docker container started with compose v3

(Xavier Martin) #1

Hi all,

My first post ever on this forum.
I am trying to find a solution to what I think is a simple problem.
I want my app within a docker container to access the host network (and devices on the network) - what the app I’m developing needs to do is listing the mac addresses and ips (arp / nmap) of the devices on the host network.

  • I start the container using docker compose v3
  • The application needs to be accessible from outside and the application needs to be able to list devices on the host network.

I’ve been looking around for a couple of days but can’t find the right settings it seems.

Thanks :slight_smile:

(Akurtlloyd) #2

I am wondering how to do something similar too. I have an app within a container started via Compose and am trying to access another app running outside of the container on the host machine. From what I can tell, it connects when I use the host’s “external” IP address. Of course, this IP address continually changes so its not a good idea to use it. It does not work when I attempt to use the 192.x.x.x IP address. I am also not able to use the variable in Compose or localhost or 127.x.x.x. I should add that I am starting my container in Compose with the network_mode: "host" set.

Is there some variable that is available to Compose that can access the other IP address? Maybe, something like

@nolazybits have you tried using to access your app?


(Xavier Martin) #3

Thanks @akurtlloyd I’m going to give it a try :slight_smile: and will let you know (prolly in the next week or so)