How to get local ip address?

My n8n deployment environment is Windows 11+Docker desktop. I want to obtain the local IP address of the host’s network card. How can I do it? Can Java script code be implemented through code nodes? How to write JavaScript code?
If your question hasn’t been asked before, please follow the template below. Skip the questions that are not relevant to you. →

Describe the problem/error/question

What is the error message (if any)?

Please share your workflow

(Select the nodes on your canvas and use the keyboard shortcuts CMD+C/CTRL+C and CMD+V/CTRL+V to copy and paste the workflow.)

Share the output returned by the last node

Information on your n8n setup

  • n8n version:
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system:

Use execute command node should be fine

Not test in windows. But use ifconfig work in linux.

To find the public IP address used for outgoing internet requests, you can use a public API.

Thank you very much. I’ll give it a try

Thank you very much.

What I want is the local IP address of the host computer. How can I implement it?

Command failed: ipconfig /bin/sh: ipconfig: not found

My n8n deployment environment is Windows 11+Docker Desktop, and the above error message appears?

The safest way to reach the host from within Docker is to use the internal domain host.docker.internal instead of the IP address.

Docker containers, including the host, usually run in their own network. Because of this, the Windows machine will have multiple IP addresses. host.docker.internal resolves to the Docker network’s internal IP address.

What are you trying to do? Do you just need to access internal services? If so, using host.docker.internal should be enough.

Do you really need the host machine’s IP address? If so, you’ll probably need to pass it as an environment variable when starting the container.

There’s also an option to use the host machine’s network when starting the container (--network host), but Docker containers on Windows and MacOSX run in their own virtual machine.

thank you very much