This guide will walk you through setting up Docker inside WSL to run the Aztec node on Windows. The setup includes configuring port forwarding, installing Docker, setting up the Aztec node, and verifying the ports are being forwarded correctly.
Before installing Docker inside WSL, we need to uninstall Docker Desktop if it’s installed on your Windows system:
- Open Settings > Apps.
- Find Docker Desktop, click Uninstall, and follow the prompts to remove it.
We will install Ubuntu on WSL:
-
Open PowerShell as Administrator.
-
Run the following command to install Ubuntu:
wsl --install -d Ubuntu
After installation, you can launch it from the Start Menu by searching for Ubuntu.
By default, WSL uses a non-root user. Let’s change that:
-
Enable root and set password:
Run the following command to set a password for the root user:
sudo passwd root
-
Set root password: You will be prompted to enter and confirm a new password for the root user.
-
Exit root to return to your regular user:
exit
To forward ports from Windows to WSL, you need to use the current IP address of your WSL instance.
-
Open WSL and run the following command to get your current IP address:
ip addr | grep inet
This will output something like:
inet 172.18.151.151/20 brd 172.18.159.255 scope global eth0
Look for the inet
line under eth0 to find the IP address of your WSL instance. In this example, it is 172.18.151.151
.
- Open PowerShell as Administrator and add port forwarding for ports 40400 and 8080:
Replace 172.18.151.151
with your IP address from the previous step.
netsh interface portproxy add v4tov4 listenport=40400 listenaddress=0.0.0.0 connectport=40400 connectaddress=YOUR_WSL_IP
netsh interface portproxy add v4tov4 listenport=8080 listenaddress=0.0.0.0 connectport=8080 connectaddress=YOUR_WSL_IP
Example: If your WSL IP is 172.18.151.151
, the command will look like:
netsh interface portproxy add v4tov4 listenport=40400 listenaddress=0.0.0.0 connectport=40400 connectaddress=172.18.151.151
netsh interface portproxy add v4tov4 listenport=8080 listenaddress=0.0.0.0 connectport=8080 connectaddress=172.18.151.151
Ensure Windows allows incoming traffic on the ports you’ve forwarded:
- Add firewall rules in PowerShell (Admin):
New-NetFirewallRule -DisplayName "Allow 40400" -Direction Inbound -Protocol TCP -LocalPort 40400 -Action Allow
New-NetFirewallRule -DisplayName "Allow 8080" -Direction Inbound -Protocol TCP -LocalPort 8080 -Action Allow
- Verify the port forwarding:
netsh interface portproxy show v4tov4
You should see:
Listen on ipv4: Connect to ipv4:
0.0.0.0:40400 172.18.151.151:40400
0.0.0.0:8080 172.18.151.151:8080
Now that Docker Desktop is removed, let’s install Docker inside WSL.
su
sudo apt update -y
sudo apt install apt-transport-https ca-certificates curl software-properties-common -y
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable" -y
sudo apt update -y
sudo apt install docker-ce -y
sudo chmod 777 /var/run/docker.sock
sudo docker --version
sudo docker run hello-world
Ensure the firewall is correctly configured:
-
Install UFW (if not installed - also using root/su):
sudo apt install ufw -y
-
Allow Docker and SSH:
ufw allow 22 ufw allow ssh ufw enable
-
Allow Aztec Node Ports:
ufw allow 40400 ufw allow 8080
exit
Now, let’s install and configure your Aztec node on the alpha-testnet:
- Install Packages:
sudo apt install curl iptables build-essential git wget lz4 jq make gcc nano automake autoconf tmux htop nvme-cli libgbm1 pkg-config libssl-dev libleveldb-dev tar clang bsdmainutils ncdu unzip libleveldb-dev -y
-
Install Aztec:
bash -i <(curl -s https://install.aztec.network)
-
Update your PATH:
echo 'export PATH="$HOME/.aztec/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc
- Start Aztec Node:
aztec-up alpha-testnet
aztec start --node --archiver --sequencer \
--network alpha-testnet \
--l1-rpc-urls RPC_URL \
--l1-consensus-host-urls BEACON_URL \
--sequencer.validatorPrivateKey 0xYourPrivateKey \
--sequencer.coinbase 0xYourAddress \
--p2p.p2pIp YOUR_IP \
--p2p.maxTxPoolSize 1000000000
While the node is running, check if ports 40400 and 8080 are being forwarded correctly (do this after 20-30mins):
sudo lsof -iTCP -sTCP:LISTEN -P | grep -E ':8080|:40400'
You should see something like:
docker-pr 14254 root 4u IPv4 78228 0t0 TCP *:40400 (LISTEN)
docker-pr 14261 root 4u IPv6 78233 0t0 TCP *:40400 (LISTEN)
docker-pr 14301 root 4u IPv4 78250 0t0 TCP *:8080 (LISTEN)
docker-pr 14308 root 4u IPv6 78253 0t0 TCP *:8080 (LISTEN)
If you still encounter the 0peers issue after completing the setup, you may need to port forward ports 8080 and 40400 on your router/modem to ensure proper network connectivity and peer synchronization.
- The idea of installing Docker inside a VM was inspired by the work of Vikash Kumar and his installation script.
- This guide adapts his method to work with WSL instead of a traditional VM, allowing Docker to run inside Windows Subsystem for Linux.