Run Web App with Docker on WSL

/img/collections/collections8.png

πŸš€ Run Your Web App with Docker – RoadMasters Guide

Running your web app in Docker is now easier than ever! Here’s a quick guide to get started.


Prerequisites

  • Install Docker
  • Windows Users: Install Docker Desktop and WSL with Ubuntu

πŸ‘‰ Get started with Docker containers on WSL
πŸ‘‰ Install Ubuntu on Windows 10 WSL without Microsoft Store


Fix VPN Issues

If you’re using Cisco AnyConnect, follow this WSL 2 Cisco AnyConnect Networking Workaround.

Steps:

  1. Connect to the VPN.
  2. Open PowerShell as Administrator and run:
    Get-NetAdapter | Where-Object {$_.InterfaceDescription -Match "Cisco AnyConnect"} | Set-NetIPInterface -InterfaceMetric 6000
    ping 8.8.8.8
    (Get-NetAdapter | Where-Object InterfaceDescription -like "Cisco AnyConnect*" | Get-DnsClientServerAddress).ServerAddresses
    
  3. Update /etc/resolv.conf in Ubuntu:
    nameserver 10.10.0.124
    nameserver 10.10.0.132
    

Clone the Project

For Windows:

git clone git...
git config --global core.autocrlf false

Environment Setup

From the docker folder:

  • Copy .env.example β†’ .env
  • Copy docker-compose.override.example.yml β†’ docker-compose.override.yml
  • Copy dev_tools/php-override.example.ini β†’ dev_tools/php-override.ini
  • Copy php/php-override.example.ini β†’ php/php-override.ini

Run the App

docker compose up -d

Tip: If pulling fails on Windows, pull base images one by one.


Ready to containerize your app? Start now!


Written By

Marco Martorana

Software Engineer | Computer Science Teacher