Connecting Cloud n8n with Local Ollama – Complete Tutorial

an abstract image of a sphere with dots and lines

Introduction

This tutorial will guide you through connecting your cloud-hosted n8n instance with Ollama running locally on your PC. We’ll cover multiple methods, from quick testing solutions to more permanent setups.

What is Ollama?

Ollama is a free, open-source application that lets you run large language models (LLMs) locally on your own computer. Think of it as having ChatGPT running on your PC instead of in the cloud.

Prerequisites

  • n8n instance hosted in the cloud (e.g., n8n.cloud, self-hosted VPS)
  • Ollama installed and running on your local PC
  • Basic command line knowledge
  • Administrator access to your PC

Understanding the Problem

Your cloud n8n instance cannot directly access your local Ollama because:

  • Your local PC is behind a router/firewall
  • It doesn’t have a public IP address accessible from the internet
  • Cloud services can only connect to publicly accessible endpoints

Solution: Create a secure tunnel that exposes your local Ollama to the internet.


Method 1: Using ngrok (Best for Testing)

Why ngrok?

  • Quick setup (5 minutes)
  • Free tier available
  • Automatic HTTPS
  • Perfect for development and testing

Step 1: Install ngrok

  1. Visit ngrok.com and create a free account
  2. Download ngrok for your operating system
  3. Extract the executable to a folder (e.g., C:\ngrok)

Step 2: Configure ngrok

  1. Copy your authtoken from the ngrok dashboard
  2. Open Command Prompt or PowerShell and run: ngrok config add-authtoken YOUR_AUTH_TOKEN

Step 3: Start Ollama

  1. Make sure Ollama is running on your PC
  2. By default, Ollama runs on port 11434
  3. Test it locally by opening: http://localhost:11434

Step 4: Create the Tunnel

  1. Open a new terminal window
  2. Run: ngrok http 11434
  3. You’ll see output like: Forwarding https://abc123-456.ngrok.io -> http://localhost:11434
  4. Copy this URL – this is your public Ollama endpoint!

Step 5: Configure n8n

  1. Log into your n8n instance
  2. Create a new workflow
  3. Add an HTTP Request node
  4. Configure it:
    • Method: POST
    • URL: https://abc123-456.ngrok.io/api/generate
    • Authentication: None
    • Body: JSON
    • JSON Body: { "model": "llama2", "prompt": "Why is the sky blue?", "stream": false}
  5. Execute the node to test

Step 6: Parse the Response

  1. Add a Set node after the HTTP Request
  2. Extract the response:
    • Name: ollama_response
    • Value: {{ $json.response }}

Important Notes for ngrok

  • Free tier: Your URL changes every time you restart ngrok
  • Keep terminal open: The tunnel stays active only while ngrok is running
  • Paid tier: Get a permanent URL that doesn’t change

Method 2: Using Cloudflare Tunnel (Best for Permanent Setup)

Why Cloudflare Tunnel?

  • Free forever
  • More reliable than ngrok free tier
  • Can create named tunnels
  • Better for long-term projects

Step 1: Install Cloudflare Tunnel

Windows (using winget):

winget install --id Cloudflare.cloudflared

Windows (manual):

  1. Download from Cloudflare’s website
  2. Extract to a folder like C:\cloudflared
  3. Add to PATH or use full path in commands

Linux/Mac:

# Linux
wget https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-amd64.deb
sudo dpkg -i cloudflared-linux-amd64.deb

# Mac
brew install cloudflare/cloudflare/cloudflared

Step 2: Authenticate Cloudflare

  1. Run: cloudflared tunnel login
  2. Your browser will open – log in with your Cloudflare account
  3. Select a domain (or create one free at Cloudflare)
  4. Authorize the tunnel

Step 3: Quick Tunnel (Temporary)

For quick testing:

cloudflared tunnel --url http://localhost:11434

This gives you a temporary URL like: https://random-words.trycloudflare.com

Step 4: Named Tunnel (Permanent)

For a permanent setup:

  1. Create a tunnel: cloudflared tunnel create ollama-tunnel Note the tunnel ID that appears
  2. Create a config file (~/.cloudflared/config.yml or C:\Users\YourName\.cloudflared\config.yml): tunnel: TUNNEL_ID_HERE credentials-file: C:\Users\YourName\.cloudflared\TUNNEL_ID.json ingress: - hostname: ollama.yourdomain.com service: http://localhost:11434 - service: http_status:404
  3. Create DNS record: cloudflared tunnel route dns ollama-tunnel ollama.yourdomain.com
  4. Run the tunnel: cloudflared tunnel run ollama-tunnel
  5. Run as a service (optional, so it starts automatically): # Windows (PowerShell as Admin) cloudflared service install # Linux sudo cloudflared service install

Step 5: Use in n8n

Use your tunnel URL: https://ollama.yourdomain.com/api/generate


Method 3: Router Port Forwarding (Advanced)

Why Port Forwarding?

  • No third-party service needed
  • Full control
  • Best performance

When NOT to use this:

  • You don’t have a static IP
  • Your ISP blocks incoming connections
  • You’re not comfortable with network security

Steps:

  1. Find your local IP:
    • Windows: Run ipconfig in CMD
    • Look for “IPv4 Address” (e.g., 192.168.1.100)
  2. Access your router:
    • Usually 192.168.1.1 or 192.168.0.1
    • Log in with admin credentials
  3. Create port forwarding rule:
    • External Port: 11434
    • Internal IP: Your PC’s IP (e.g., 192.168.1.100)
    • Internal Port: 11434
    • Protocol: TCP
  4. Configure Windows Firewall: # Run as Administrator New-NetFirewallRule -DisplayName "Ollama" -Direction Inbound -LocalPort 11434 -Protocol TCP -Action Allow
  5. Set up Dynamic DNS (if no static IP):
    • Use services like DuckDNS, No-IP, or Dynu
    • Install their client on your PC
    • Get a free domain like yourname.duckdns.org
  6. Use in n8n:
    • URL: http://YOUR_PUBLIC_IP:11434/api/generate
    • Or: http://yourname.duckdns.org:11434/api/generate

Building a Complete n8n Workflow

Here’s a practical example workflow that uses your local Ollama:

Workflow: AI-Powered Email Responder

  1. Trigger Node: Manual Trigger or Webhook
  2. HTTP Request Node (Call Ollama):
    • Method: POST
    • URL: YOUR_TUNNEL_URL/api/generate
    • Body: { "model": "llama2", "prompt": "Write a professional email response to: {{ $json.email_content }}", "stream": false}
  3. Code Node (Parse Response): const response = $input.item.json.response; return [{ json: { ai_response: response } }];
  4. Send Email Node or Slack Node:
    • Use {{ $json.ai_response }} as the message

Security Best Practices

1. Add Basic Authentication

Wrap your Ollama endpoint with a reverse proxy (nginx, Caddy) that requires authentication.

2. Use HTTPS Only

  • ngrok: Provides HTTPS automatically
  • Cloudflare: HTTPS by default
  • Port forwarding: Set up Let’s Encrypt

3. IP Whitelisting

If your n8n instance has a static IP, configure your firewall to only accept connections from that IP.

4. Monitor Access

  • Check ngrok/Cloudflare dashboards for unusual traffic
  • Set up alerts for excessive requests

5. Use Environment Variables in n8n

Store your tunnel URL as an environment variable instead of hardcoding it:

  • URL: {{ $env.OLLAMA_URL }}/api/generate

Troubleshooting

“Connection Refused” Error

Check:

  1. Is Ollama running? Test: curl http://localhost:11434
  2. Is your tunnel active? Check the terminal window
  3. Is the URL correct in n8n?

“Timeout” Error

Solutions:

  1. Increase timeout in n8n HTTP Request settings
  2. Use smaller models or shorter prompts
  3. Check your internet connection speed

ngrok URL Changed

Solution:

  • Upgrade to ngrok paid plan for static URLs
  • Or switch to Cloudflare Tunnel (free permanent URLs)

Ollama Not Responding

Check:

  1. Restart Ollama service
  2. Check if port 11434 is already in use: # Windowsnetstat -ano | findstr :11434
  3. Check Ollama logs for errors

Firewall Blocking Connection

Windows:

# Allow Ollama through firewall
New-NetFirewallRule -DisplayName "Ollama" -Direction Inbound -Program "C:\Program Files\Ollama\ollama.exe" -Action Allow

Performance Tips

  1. Use "stream": false in your requests for easier n8n handling
  2. Keep models small for faster responses (e.g., llama2:7b instead of llama2:70b)
  3. Cache responses in n8n if you’re asking the same questions repeatedly
  4. Set appropriate timeouts – AI generation can take 30-60 seconds for longer responses

Cost Comparison

MethodFree TierPaid TierBest For
ngrokURL changes on restart$8/month for static URLTesting
CloudflareFree foreverFree (or paid plans available)Production
Port ForwardFreeFreeAdvanced users

Next Steps

  1. Test the connection with simple prompts
  2. Build a workflow that uses your local LLM
  3. Secure your setup using the security practices above
  4. Scale up by running multiple Ollama models
  5. Automate the tunnel startup using system services

Additional Resources


Conclusion

You now have multiple ways to connect your cloud n8n with local Ollama:

  • Quick testing: Use ngrok
  • Long-term projects: Use Cloudflare Tunnel
  • Maximum control: Use port forwarding

Start with ngrok to test everything works, then move to Cloudflare Tunnel for a permanent setup. Happy automating with local LLMs!

How to Set Up PGP Encryption on Outlook in Windows 11

A wooden block spelling the word encryption on a table

This guide will walk you through setting up PGP (Pretty Good Privacy) encryption for your Outlook email client on Windows 11. Whether you’re starting fresh or migrating from another email client like Thunderbird, this tutorial has you covered.

What You’ll Need

  • Outlook 2016, 2019, or Microsoft 365
  • Windows 11
  • Administrator access to install software
  • Your existing PGP keys (if migrating from another client)

Step 1: Install Gpg4win

Gpg4win is a free, open-source encryption suite that integrates PGP functionality into Outlook.

  1. Download Gpg4win from the official website: https://www.gpg4win.org/
  2. Run the installer (right-click and select “Run as administrator” if needed)
  3. During the installation, you’ll see a component selection screen
  4. Important: Make sure these components are checked:
    • GpgOL – This is the Outlook plugin (critical!)
    • Kleopatra – Certificate and key manager
    • GpgEX – Windows Explorer extension (optional but useful)
  5. Click Next and complete the installation
  6. Restart your computer to ensure all components load properly

Step 2: Set Up Your PGP Keys

If You’re Starting Fresh

  1. Open Kleopatra (search for it in the Start menu)
  2. Click File ? New OpenPGP Key Pair
  3. Enter your name and email address
  4. Click Create
  5. Set a strong passphrase when prompted (you’ll need this to decrypt messages)
  6. Click Finish

If You Have Existing Keys (e.g., from Thunderbird)

Export Keys from Thunderbird

  1. Open Thunderbird
  2. Go to Tools ? OpenPGP Key Manager
  3. Find your key in the list
  4. Right-click your key ? Export Keys to File
  5. Choose to export both public and secret keys
  6. Save the file (e.g., my-pgp-key.asc) to a location you’ll remember

Import Keys into Kleopatra

  1. Open Kleopatra
  2. Click File ? Import Certificates
  3. Navigate to your exported key file (.asc or .gpg file)
  4. Select the file and click Open
  5. Enter your passphrase if prompted
  6. You should see a confirmation that the keys were imported successfully

Step 3: Verify GpgOL is Installed in Outlook

  1. Open Outlook
  2. Look for a GpgOL tab in the ribbon at the top of the window
  3. If you see it, skip to Step 5

If You Don’t See the GpgOL Tab

Don’t worry – you might not have selected it during installation. Here’s how to add it:

  1. Go to Windows Settings ? Apps ? Installed apps
  2. Find Gpg4win in the list
  3. Click the three dots (?) next to it
  4. Select Modify
  5. The installer will open showing current components
  6. Make sure GpgOL is checked
  7. Click Next to install the component
  8. Restart Outlook

Alternative Check: Outlook Add-ins

  1. In Outlook, go to File ? Options ? Add-ins
  2. Look for “GpgOL” in the active add-ins list
  3. If it’s in “Disabled Items”, you’ll need to enable it:
    • At the bottom, change “Manage” dropdown to Disabled Items
    • Click Go
    • Select GpgOL and click Enable

Step 4: Configure GpgOL in Outlook

  1. Open Outlook and click the GpgOL tab
  2. Click Settings (or Options)
  3. In the settings window:
    • Select your default key for signing and encrypting emails
    • Choose whether to sign/encrypt by default (recommended to leave off and choose per email)
    • Configure any other preferences

Step 5: Send Your First Encrypted Email

Sending an Encrypted Message

  1. Click New Email in Outlook
  2. Compose your message as normal
  3. In the GpgOL tab at the top, you’ll see encryption options:
    • Click Encrypt to encrypt the message
    • Click Sign to digitally sign it (proves it’s from you)
    • You can do both for maximum security
  4. Add the recipient’s email address
  5. Important: You must have the recipient’s public key to encrypt to them
  6. Click Send

Receiving an Encrypted Message

  1. When you receive an encrypted email, GpgOL will automatically detect it
  2. You’ll be prompted to enter your passphrase
  3. After entering it, the message will decrypt and display normally

Step 6: Exchange Public Keys with Contacts

For someone to send you encrypted emails, they need your public key. For you to send to them, you need theirs.

Export Your Public Key

  1. Open Kleopatra
  2. Right-click your key
  3. Select Export Certificates
  4. Save the .asc file
  5. Send this file to your contacts (via email, chat, etc.)

Import a Contact’s Public Key

  1. Receive their public key file from them
  2. Open Kleopatra
  3. Click File ? Import Certificates
  4. Select their key file
  5. Verify the key fingerprint with them (optional but recommended for security)
  6. You can now send them encrypted emails

Troubleshooting Common Issues

GpgOL Tab Not Appearing

  • Ensure GpgOL is installed (see Step 3)
  • Check that the add-in isn’t disabled in Outlook
  • Try running Outlook as administrator once
  • Reinstall Gpg4win if necessary

“No Valid Key Found” Error

  • Make sure you’ve imported the recipient’s public key
  • Verify the email address matches exactly
  • Check that your key hasn’t expired in Kleopatra

Can’t Decrypt Received Messages

  • Verify you’re using the correct passphrase
  • Ensure the message was encrypted to your public key
  • Check that your private key is properly imported

Messages Showing as Plain Text

  • Some email servers strip encryption from messages
  • Make sure both you and the recipient are using compatible PGP implementations
  • Try sending a test message to yourself first

Security Best Practices

  1. Protect Your Passphrase: Never share it with anyone
  2. Backup Your Private Key: Store it securely offline
  3. Verify Key Fingerprints: When exchanging keys, verify fingerprints through a separate channel
  4. Set Key Expiration: Consider setting expiration dates on keys for better security
  5. Revoke Compromised Keys: If your key is compromised, generate and distribute a revocation certificate

Additional Resources

  • Gpg4win Documentation: https://www.gpg4win.org/documentation.html
  • GnuPG Manual: https://gnupg.org/documentation/
  • Email Security Best Practices: Search for “PGP email security guide”

Note: This guide uses Gpg4win, which implements the OpenPGP standard. Your encrypted emails will be compatible with other OpenPGP-compliant tools like Thunderbird, GPG Suite (Mac), and various mobile apps.

How to Remove BIOS Password on Acer Nitro 5

folded laptop

Overview

This tutorial will guide you through the process of unlocking and removing a forgotten BIOS password on your Acer Nitro 5 laptop.


Part 1: Unlocking the BIOS

Step 1: Obtain Your Unlock Key

When you attempt to enter BIOS and fail the password entry, your Acer Nitro 5 will display an unlock password key that looks like this:

Enter Unlock Password
Key: 1931050007

Write down this number exactly as shown – you’ll need it for the next step.

Step 2: Generate the Unlock Password

Use one of these trusted online BIOS password generator websites:

  • bios-pw.org (Recommended)
  • biosbug.com

Instructions:

  1. Visit one of the websites above
  2. Enter your unlock key (e.g., 1931050007)
  3. Click “Generate” or “Get Password”
  4. The website will provide one or more unlock passwords
  5. Write down all provided passwords

Step 3: Enter the Unlock Password

  1. Restart your laptop
  2. When prompted for the BIOS password, enter the generated unlock password
  3. Important: The password is case-sensitive, so enter it exactly as provided
  4. You typically have 3 attempts before temporary lockout

Part 2: Removing the BIOS Password Permanently

Once you’ve successfully unlocked the BIOS, follow these steps to permanently remove the password:

Step 1: Enter BIOS Setup

  1. Power on or restart your Acer Nitro 5
  2. Immediately press F2 repeatedly until the BIOS screen appears
  3. Enter your unlock password when prompted

Step 2: Navigate to Security Settings

  1. Use the Arrow Keys (? ? ? ?) to navigate the BIOS menu
  2. Go to the Security tab
  3. You should see options related to password settings

Step 3: Clear Supervisor Password

  1. Highlight “Set Supervisor Password” (or similar option)
  2. Press Enter
  3. When prompted, enter the current password (your unlock password)
  4. For “Enter New Password” – leave it BLANK and press Enter
  5. For “Confirm New Password” – leave it BLANK and press Enter
  6. You should see a confirmation message like “Password Uninstalled” or “Password Cleared”

Step 4: Clear Other Password Options

Check for and disable these additional password settings if present:

  • Set User Password – Follow the same steps as above to clear it
  • Set HDD Password – Clear if enabled
  • Password on Boot – Set to Disabled

Step 5: Save Changes and Exit

  1. Press F10 to save changes
  2. A confirmation dialog will appear: “Save configuration changes and exit?”
  3. Select Yes and press Enter
  4. Your laptop will restart

Part 3: Verification

After your laptop restarts:

  • It should boot directly to Windows without asking for a password
  • Try entering BIOS again (press F2 during boot) – you should enter without a password prompt
  • If successful, your BIOS password has been completely removed

Alternative Solutions

If the online password generators don’t work, try these alternatives:

Option 1: Contact Acer Support

  • Have your laptop’s serial number ready (found on the bottom of the laptop)
  • Provide proof of ownership (receipt, invoice, or purchase documentation)
  • Acer support can provide an official unlock code

Option 2: Professional Service

  • Visit an authorized Acer service center
  • Local computer repair shops can often reset BIOS passwords using hardware methods

Option 3: CMOS Battery Reset (Advanced)

Warning: This requires opening your laptop and may void warranty.

  1. Power off and unplug the laptop
  2. Remove the battery (if removable)
  3. Open the laptop case to access the motherboard
  4. Locate the CMOS battery (small coin cell battery)
  5. Remove the CMOS battery for 5-10 minutes
  6. Reinstall the battery and reassemble

Note: This method doesn’t always work on newer Acer models with protected BIOS.


Troubleshooting

Problem: Generated passwords don’t work

  • Double-check you entered the unlock key correctly
  • Try all passwords provided by the generator
  • Try a different password generator website
  • Ensure you’re entering passwords with correct capitalization

Problem: Can’t find Security tab in BIOS

  • Look for tabs named “Password” or “Authentication”
  • Check the Main tab for password options
  • Consult your laptop’s manual for specific BIOS layout

Problem: Password cleared but still prompts on boot

  • Make sure you disabled “Password on Boot” option
  • Check if HDD password is still enabled
  • Try clearing CMOS to reset all BIOS settings

Important Notes

  • Backup your data before attempting any BIOS changes
  • The unlock key is unique to your laptop and boot attempt
  • Never share your unlock key or passwords online
  • Keep a record of any new BIOS passwords you set
  • Some BIOS settings may reset to defaults after password removal

Prevention Tips

To avoid this situation in the future:

  1. Write down any BIOS passwords you set and store them securely
  2. Consider using a password manager for BIOS passwords
  3. If you don’t need a BIOS password for security, don’t set one
  4. Keep proof of purchase documentation for warranty support

Conclusion

Removing a BIOS password on an Acer Nitro 5 is straightforward once you have the unlock password. The online generators are reliable and work for most Acer laptops. If you encounter any issues, don’t hesitate to contact Acer support with your proof of ownership.

Good luck!

How to Install and Use Docker on Windows 11

a white and blue square object on a white background

This comprehensive guide walks you through installing Docker Desktop on Windows 11, setting up WSL 2, and managing your projects effectively.

Prerequisites

  • Windows 11 64-bit (Home or Pro edition)
  • Administrator access to your computer
  • Virtualization enabled in BIOS (we’ll verify this)

Step 1: Verify Virtualization is Enabled

Before installing Docker, check if virtualization is enabled on your system.

Quick Method – Task Manager

  1. Right-click on the taskbar and select Task Manager (or press Ctrl + Shift + Esc)
  2. Click on the Performance tab
  3. Click on CPU in the left panel
  4. Look at the bottom right for “Virtualization: Enabled”

If it shows “Disabled”, you’ll need to enable it in BIOS:

  1. Restart your computer
  2. Enter BIOS (usually by pressing F2, F10, Del, or Esc during startup)
  3. Find virtualization settings under Advanced, CPU Configuration, or Security:
    • Intel processors: Look for “Intel VT-x” or “Intel Virtualization Technology”
    • AMD processors: Look for “AMD-V” or “SVM Mode”
  4. Enable it and save changes
  5. Restart your computer

Step 2: Install WSL 2 and Ubuntu

Docker Desktop on Windows requires WSL 2 (Windows Subsystem for Linux).

Install WSL and Ubuntu

  1. Open PowerShell as Administrator:
    • Right-click Start menu ? Terminal (Admin) or Windows PowerShell (Admin)
  2. Run the installation command: wsl --install This installs WSL 2 and Ubuntu by default.
  3. Restart your computer when prompted
  4. After restart, Ubuntu will automatically open:
    • Create a username (can be different from your Windows username)
    • Create a password (characters won’t appear as you type – this is normal)
    • Remember this password – you’ll need it for admin tasks

Verify WSL Installation

Open PowerShell and run:

wsl --list --verbose

You should see Ubuntu listed with VERSION 2.

Step 3: Install Docker Desktop

Download and Install

  1. Go to https://www.docker.com/products/docker-desktop
  2. Download Docker Desktop for Windows
  3. Run the installer
  4. When prompted, choose “Use WSL 2 instead of Hyper-V” (recommended)
  5. Complete the installation
  6. Restart your computer

Start Docker Desktop

  1. Launch Docker Desktop from the Start menu
  2. Wait for it to start (you’ll see a whale icon in the system tray)
  3. Accept the terms and conditions if prompted

Verify Docker Installation

Open PowerShell or Command Prompt and run:

docker --version
docker run hello-world

If you see a “Hello from Docker!” message, Docker is working correctly!

Step 4: Configure Docker with WSL

Enable WSL Integration

  1. Open Docker Desktop
  2. Click the gear icon (Settings)
  3. Go to Resources ? WSL Integration
  4. Enable “Enable integration with my default WSL distro”
  5. Toggle on your Ubuntu distribution
  6. Click Apply & Restart

Now Docker will work from both Windows and Ubuntu terminals!

Step 5: Choose Where to Store Your Projects

You have two options for project location:

Option A: Keep Projects in Windows (Recommended for Cursor AI Users)

Location: C:\Users\YourUsername\Projects\your-project

Pros:

  • Easy access with Windows tools and IDEs like Cursor AI
  • Familiar file structure
  • Simple drag-and-drop

Access from Docker:

cd C:\Users\YourUsername\Projects\your-project
docker run --rm -v ${PWD}:/app your-image

Option B: Store Projects in WSL Ubuntu

Location: /home/yourusername/projects/your-project (inside Ubuntu)

Pros:

  • Faster Docker performance
  • Native Linux development environment

Access from Windows:

  • In File Explorer, type: \\wsl$\Ubuntu\home\yourusername\projects
  • Bookmark this location for easy access
  • Cursor AI can open projects from this path

Access from Ubuntu Terminal:

cd ~/projects/your-project
docker run --rm -v $(pwd):/app your-image

Working with Git in WSL

If your project is stored in WSL, follow these best practices:

Initial Setup

When you first access a Git repository in WSL from Windows PowerShell, you might see:

fatal: detected dubious ownership in repository

Solution: Always run Git commands from the Ubuntu terminal, not PowerShell.

Set Up SSH for Git

If you’re using SSH for Git (like GitLab or GitHub):

  1. Open Ubuntu terminal
  2. Generate SSH key: ssh-keygen -t ed25519 -C "your_email@example.com" Press Enter to accept defaults
  3. Copy your public key: cat ~/.ssh/id_ed25519.pub
  4. Add the key to your Git hosting service:
    • GitHub: Settings ? SSH and GPG keys ? New SSH key
    • GitLab: User Settings ? SSH Keys
    • Paste your public key and save
  5. Test the connection: # For GitHub ssh -T git@github.com # For GitLab ssh -T git@gitlab.com

Use SSH Agent (If Your Key Has a Passphrase)

To avoid entering your passphrase repeatedly:

# Start SSH agent
eval "$(ssh-agent -s)"

# Add your key
ssh-add ~/.ssh/id_ed25519

Enter your passphrase once – it will be cached for the session.

Make SSH Agent Start Automatically

Edit your bash profile:

nano ~/.bashrc

Add these lines at the end:

# Start SSH agent and add key
if [ -z "$SSH_AUTH_SOCK" ] ; then
  eval "$(ssh-agent -s)" > /dev/null
  ssh-add ~/.ssh/id_rsa 2>/dev/null
fi

Save (Ctrl+X, Y, Enter), then reload:

source ~/.bashrc

Fixing Git Line Ending Issues

If Git shows all files as modified after cloning, it’s likely a line ending issue (Windows uses CRLF, Linux uses LF).

Fix in Ubuntu Terminal

cd ~/your-project

# Configure Git to use Linux line endings
git config core.autocrlf input
git config core.filemode false

# Reset all files with correct line endings
git rm --cached -r .
git reset --hard HEAD

# Verify
git status

Prevent Future Issues

Create a .gitattributes file in your project root:

cat > .gitattributes << 'EOF'
* text=auto eol=lf
*.sh text eol=lf
EOF

git add .gitattributes
git commit -m "Add gitattributes to enforce LF line endings"

Recommended Workflow

For the best experience when using Cursor AI with WSL:

  1. Store projects in Windows (C:\Users\YourUsername\Projects\)
  2. Edit code in Cursor AI (Windows application)
  3. Run Docker commands from either PowerShell or Ubuntu terminal
  4. Run Git commands from Ubuntu terminal
  5. Keep both Cursor AI and Ubuntu terminal open side-by-side

This workflow gives you the best of both worlds: easy editing with Windows tools and proper Linux environment for Docker and Git.

Common Docker Commands

Running Containers

# Run a container
docker run image-name

# Run with port mapping
docker run -p 4000:4000 image-name

# Run with volume mounting
docker run -v ${PWD}:/app image-name

# Run in detached mode
docker run -d image-name

Managing Containers

# List running containers
docker ps

# List all containers
docker ps -a

# Stop a container
docker stop container-id

# Remove a container
docker rm container-id

Managing Images

# List images
docker images

# Remove an image
docker rmi image-name

# Build an image
docker build -t my-image .

Docker Compose

# Start services
docker-compose up

# Start in detached mode
docker-compose up -d

# Stop services
docker-compose down

# View logs
docker-compose logs

Troubleshooting

Docker Desktop Won’t Start

  • Ensure virtualization is enabled in BIOS
  • Check that WSL 2 is properly installed: wsl --list --verbose
  • Restart Docker Desktop
  • Restart your computer

“Cannot connect to Docker daemon”

  • Make sure Docker Desktop is running (check system tray)
  • In Docker Desktop settings, verify WSL integration is enabled

Slow Performance

  • Store projects in WSL filesystem instead of Windows for better performance
  • Allocate more resources to Docker in Settings ? Resources

Git Shows All Files Modified

  • Follow the line ending fix in the “Fixing Git Line Ending Issues” section above

Conclusion

You now have a fully functional Docker development environment on Windows 11! This setup allows you to:

  • Run Docker containers efficiently using WSL 2
  • Use your favorite Windows tools like Cursor AI for development
  • Leverage Linux commands and tools through Ubuntu
  • Manage Git repositories properly with SSH authentication

Happy coding!