Print from Docker container or WSL — network bridge fix
Joe B.
Reviewed for technical accuracy
Specialities: Windows 11/10, WSL2, Docker, Networking, CUPS/IPP, Office Printers
Print from Docker container, Linux container, or WSL2 — bridge to host printer (IPP, LPD, Raw 9100)
Quick answer: the accepted fix
Accepted fix when printing from Docker or WSL2 is not working: move the container/WSL to a same‑subnet bridge (macvlan/transparent) or allow routes to the LAN, then print via IPP or Raw 9100. Permit ports 631/9100/515 through firewall/VPN and configure CUPS or direct socket printing.
Containers can’t see printers after enabling VPN — allow local LAN
Many VPN clients disable access to local subnets for security. Enable Allow local LAN or add a split‑tunnel for the printer’s network. Then ensure the Docker/WSL adapter has a route to that subnet and your firewall allows IPP/LPD/9100 egress.
How to verify container/WSL printing works
From inside the container or WSL2: curl http://192.168.1.60 (many printers host a status page). For CUPS, run lpstat -p -d and send a test job with lp -d PRINTER /etc/hosts. For Raw printing, open TCP 9100 and send a small PCL/PS test — if it emerges, your bridge fix is good.
Printing from Docker or WSL — troubleshooting tips
Most issues come from isolation (NAT, VPN) or missing firewall routes.
Quick path: verify LAN route → switch to macvlan/transparent or permitted bridge → open ports 631/9100/515 → configure CUPS or Raw printing → prefer static IP/IPP URL over discovery.
Disclaimer: This information is AI-generated and intended for general guidance only. For advice specific to your environment, please consult a verified expert on Whizz-Tech before making decisions.
Getting Started Is Easy
Ask for help, 24/7
Members enjoy round-the-clock access to 12,000+ verified Experts, including tech support, mechanics, vets, and more.
Expert will respond in minutes
We match you with an Expert who specializes in your situation. Talk, text, or chat — whichever you prefer.
Save time & money
No scheduling hassles or expensive consults. Membership can save you significant time and money each month.
FAQ
Why can’t my Docker container see the network printer?
Default Docker NAT bridge may not route to your LAN or VPN blocks local subnets. Use macvlan/transparent networking or --network=host (where allowed), then print via IPP (631) or Raw 9100.
How do I print from WSL2?
Install CUPS in WSL2 and add the printer using IPP/Raw. Or target the Windows print queue via ipp://host.docker.internal/.... Ensure VPN/firewall allows access to the printer’s subnet.
IPP vs Raw 9100 vs LPD — which is best in containers?
IPP is modern and encrypted when using IPPS; Raw 9100 is simplest for pre‑rendered jobs; LPD works with legacy print servers. All require routes and open ports (631/9100/515).
Can I print to a Windows print server from Docker?
Yes. Configure CUPS to forward to the Windows server via IPP or SMB. Make sure DNS resolves the server and that firewall allows the required protocols from the Docker network.
Do I need Bonjour/Avahi?
Only for discovery. In locked environments, prefer a static IP and direct IPP/Raw URL instead of mDNS broadcast.
| Symptom | Likely cause | Quick fix |
|---|---|---|
| Printer not visible in container | NAT/VPN isolation | Use macvlan/transparent or permitted routes |
| Jobs time out | Firewall blocking 631/9100/515 | Allow IPP/LPD/Raw on Docker/WSL adapters |
| WSL2 can’t reach LAN | VPN denies local LAN | Enable “Allow local LAN” or split‑tunnel |
| Discovery fails | No mDNS across segments | Use printer static IP and IPP URL |
Step‑by‑step (Docker Desktop & WSL2 on Windows)
- Create a transparent/macvlan network or enable a route to the printer’s subnet.
- Open firewall for TCP 631/9100/515 on DockerNAT/WSL adapters.
- In the container/WSL, install CUPS (if needed) and add the printer via IPP or Raw 9100.
- On VPN clients, turn on Allow local LAN or add a split‑tunnel for the printer network.
Step‑by‑step (Docker on macOS & Linux)
- Prefer bridge with route or macvlan to place containers on the LAN.
- Point apps to
ipp://printer-ip/ipp/printorsocket://printer-ip:9100. - Use Avahi only when discovery is required; otherwise stick to IP addresses.
Sources
- Docker — Networking overview
- Microsoft — Windows Subsystem for Linux (WSL)
- OpenPrinting — CUPS & IPP Everywhere
- Microsoft — Troubleshoot printer problems (Windows 10/11)
Filed under: Printers
Related articles
- My print job is stuck on “Submitting” — and it won’t send to the printer
- Print job stuck on “Processing” — why won’t it start printing?
- Print job disappears from the queue and nothing prints — what happened?
- My printer “forgot” my Wi-Fi — the saved network is gone
- Printer says “Offline” and won’t print — what should I check first?
- Printer Wi-Fi settings reset by itself — why did it forget my network?
- My printer keeps popping up “Set up Wi-Fi” again — why won’t it stay connected?
- Why does my printer need Wi-Fi setup again? It was working yesterday.