To access your local Docker container running n8n from another computer, you'll need to ensure a few things are set up correctly. Here are the general steps:
Prerequisites
- Docker Installed: Make sure Docker is installed on the local computer where n8n is running.
- n8n Running: Ensure that the n8n container is running.
Steps to Make n8n Accessible from Other Computers
Step 1: Find Your Local Machine's IP Address
You need the local IP address of the machine running the n8n container.
- On Windows, you can find your IP address by running
ipconfig in Command Prompt.
- On macOS or Linux, use
ifconfig or ip a.
Look for the IP address that corresponds to your local network (often something like 192.168.x.x).
Step 2: Start n8n Container with Correct Port Mapping
When you run your n8n container, you need to map the ports correctly. The default n8n port is 5678. You can run the container with the following command:
docker run -d \
--name n8n \
-e N8N_HOST=your_local_ip_address \
-e N8N_PORT=5678 \
-e N8N_PROTOCOL=http \
-p 5678:5678 \
n8n
Make sure to replace your_local_ip_address with the actual IP address found in the previous step.
Step 3: Configure Firewall (if necessary)
Ensure that your firewall is configured to allow incoming connections on port 5678:
- Windows Firewall: Allow inbound connections for the specific port.
- Linux: Use
ufw or iptables to allow the connection.
- macOS: Go to System Preferences > Security & Privacy > Firewall options and allow connections on port
5678.
Step 4: Access n8n from Another Computer
On the other computer, open a web browser and access your local n8n instance using the local IP address. The URL would look like this:
http://your_local_ip_address:5678
Replace your_local_ip_address with the IP address of your local machine.
Optional: Use a Reverse Proxy (like Nginx)
For production use, you might want to set up a reverse proxy (like Nginx) for better management of requests and using HTTPS.
Note
If you are running this setup within a different network or using services like VPNs, you might need to adjust additional configurations, including port-forwarding in your router if you're trying to access it from outside your local network.
Conclusion
Following these steps will help you set up n8n running in Docker on your local machine and allow access from other computers on the same network. Make sure to check networking configurations and firewall settings to troubleshoot any connectivity issues.