Printer troubleshooting technician providing live chat help

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)

Technician avatar Technician
Hey! We’ll get printing from Docker containers or WSL2 working. Tell me if the printer is USB on the Windows host, a network printer (IPP/LPD/Raw 9100), or a shared Windows print queue. Also share whether the container runs on Linux or Windows, and which app needs to print (CUPS, Java, Python, ERP, etc.).
Customer
Windows 11 Pro laptop. Printer is an HP network laser on IP 192.168.1.60 (supports IPP and 9100). My Docker Linux container can’t see it, and WSL2 printing also fails. Ping from host works; from container it says host unreachable.
Technician avatar Technician
Got it. Common reasons containers/WSL can’t reach printers:
• Docker using default NAT bridge without route to the LAN; corporate VPN may isolate the adapter.
• Firewall blocks IPP (631), LPD (515) or Raw/JetDirect (9100) from the Docker/WSL vSwitch.
• You’re using localhost; but from a container use host.docker.internal for host services, or the printer’s LAN IP.
• WSL2 has its own virtual NIC; it needs LAN access & mDNS/Bonjour if you rely on discovery.
Plan: switch to transparent/bridged networking (or network=host where safe), open ports, and configure CUPS in the container to print via IPP/Raw.
Customer
What’s the simplest Docker network bridge fix? I’m fine with exposing only what’s needed.
Technician avatar Technician
Docker → printer access (Windows or Linux hosts):
1) If the printer is on your LAN, create a macvlan/transparent network so the container gets an IP on the same subnet; then the printer’s IP (192.168.1.60) is reachable.
2) On Windows hosts, for quick tests you can run with --network=host in Docker Desktop (Linux containers only) to inherit the host routes/VPN. Use with care in shared environments.
3) In the app, print via IPP URI (e.g., ipp://192.168.1.60/ipp/print) or socket/Raw 9100 (socket://192.168.1.60:9100). Avoid SMB printing from containers unless absolutely needed.
4) Ensure the host firewall allows outbound 631/515/9100 from the Docker vSwitch. On corporate VPN, add a split‑tunnel or “allow local LAN” rule.
Customer
We also need to print from WSL2 (Ubuntu). Can WSL talk to the same printer without Docker?
Technician avatar Technician
Print from WSL2:
• Make sure “Allow LAN access” is enabled in your VPN; otherwise WSL’s vNIC can’t reach 192.168.1.60.
• Install CUPS inside WSL (cups, cups-client), start the service, and add the printer with IPP/Raw 9100.
• If you prefer using the Windows queue, point to ipp://host.docker.internal/printers/<queue> or smb://host/PrinterShare with WSL ↔ Windows loopback.
• For discovery, install Avahi/Bonjour in WSL or use the printer’s static IP to bypass mDNS.
Customer
Our security team limits host network. Can we still print from containers without that?
Technician avatar Technician
Locked‑down alternative: keep default bridge but add an egress policy/route to the printer subnet only. Use Docker’s --add-host to pin DNS and a SNAT rule so replies route back. This preserves isolation while enabling container‑to‑printer traffic over ports 631/9100/515.
Customer
We run a microservice that generates PDFs. Do we need CUPS in the container or can we just stream to 9100?
Technician avatar Technician
When to use CUPS vs Raw 9100:
• Raw 9100 (JetDirect) is simplest if the app renders printer‑ready PCL/PostScript/PDF — just open TCP 9100 and send the job.
• Use CUPS with IPP Everywhere when you need page control, tray selection, duplex, or driverless printing. CUPS can also relay to a Windows print server via SMB/IPP.
Customer
After we connect, jobs vanish. Could Windows Defender Firewall or the VPN be dropping them?
Technician avatar Technician
Likely. Add inbound/outbound allow rules for the vEthernet (DockerNAT) / WSL adapters and ports 631, 9100, 515. In the VPN client enable “Allow local LAN access” or create a split‑tunnel exception for the printer’s subnet so container and WSL can reach the gateway.
Customer
Any app‑specific gotchas? We print from Java and Python.
Technician avatar Technician
Java/Python in containers: for Java, use IPP libraries or write to socket://printer:9100. For Python, pycups (IPP) or socket for raw jobs. Ensure the container’s DNS resolves the printer (add --add-host printer:192.168.1.60 or use static IP). Save a CUPS default with duplex/tray if needed.
Customer
We sometimes switch Wi‑Fi/VPN. Can we make this persistent so printing keeps working?
Technician avatar Technician
Yes. Give the printer a static IP/DHCP reservation. Create a Docker macvlan or policy‑routed bridge that survives restarts. In WSL2, persist routes in /.wslconfig or a startup script, and keep a CUPS queue with the printer’s IPP URL rather than mDNS/Bonjour names.
Customer
Great — container and WSL can now print to the HP over IPP and 9100. Thanks!
Technician avatar Technician
Summary: To print from Docker containers or WSL2, place the workload on a bridged/macvlan or permitted network, open ports 631/9100/515, and aim CUPS or your app at the printer’s IPP/Raw endpoint. Use host.docker.internal only for Windows queues hosted on the machine. Need help tailoring routes and firewall/VPN rules? Open the chat.

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.

Common container/WSL printing problems and quick fixes
SymptomLikely causeQuick 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)

  1. Create a transparent/macvlan network or enable a route to the printer’s subnet.
  2. Open firewall for TCP 631/9100/515 on DockerNAT/WSL adapters.
  3. In the container/WSL, install CUPS (if needed) and add the printer via IPP or Raw 9100.
  4. On VPN clients, turn on Allow local LAN or add a split‑tunnel for the printer network.

Step‑by‑step (Docker on macOS & Linux)

  1. Prefer bridge with route or macvlan to place containers on the LAN.
  2. Point apps to ipp://printer-ip/ipp/print or socket://printer-ip:9100.
  3. Use Avahi only when discovery is required; otherwise stick to IP addresses.

Sources

Matt Verified Icon
Matt ● replies in < 1 min
Technician Expert
⭐⭐⭐⭐⭐ Trusted by 27,000+ customers
Avatar
Alex · Expert's Assistant