Docker and Python debugging in VS Code error: timed out waiting for launcher to connect

Scenario: you have a Linux machine and you're creating a Dockerized Python app. You fire up Visual Studio Code, follow the official instructions, and eagerly hit F5 to test your app.

But nothing happens, except an error dialog after about 15 seconds:

This may be your firewall blocking connections on the docker network interface.

To confirm this, turn off your firewall, launch a debug process in VS Code, and see if the debug session starts. Repeat with the firewall on. If that fails, it's time to add rules allowing traffic for the docker interface.

First, find the subnet for your docker interface:

In this instance, you want traffic allowed through docker0 over its IP range, which in my case is Yours may be different.

In a terminal, add those rules:

sudo ufw allow out on docker0 from
sudo ufw allow in on docker0 from

Reload your firewall config, and your debugging should start working.

sudo ufw reload


How to Resolve Windows Host Names on your LAN from a Linux Machine

Resolving Windows host names on a LAN from a Linux machine is tricky and changes often enough that most AskUbuntu or Stack Overflow "solutions" don't work as of Feb 2021.

This method works in KDE Neon 5.20 with Kernel 5.4.0-65-generic and should work with most Ubuntu 20.x versions.

The idea is to give your Ubuntu machine your router's / DHCP server's address as a secondary DNS server.

The difficulty is that the standard /etc/resolv.conf file gets clobbered when the NetworkManager service starts. The trick is how to manage resolv.conf manually.


  • A LAN
  • A Windows host on the LAN with default network configuration, in WORKGROUP
  • A Ubuntu 20.x machine

All of the following happens on the Ubuntu machine. The Windows host doesn't need any reconfiguration.


  1. Tell NetworkManager not to provide DNS resolution
  2. Create your own resolv.conf

Create /etc/NetworkManager/conf.d/90-dns-none.conf file with the following content:


Step 1.1
Restart NetworkManager
sudo systemctl reload NetworkManager

Step 2
If /etc/resolv.conf is a symlink to a systemd file (typically /run/systemd/resolve/resolv.conf or the stub file), remove that symlink.
Create a/etc/resolv.conf file like this (replace with your router or DHCP server's actual IP address if it's different):


Step 2.1 
Restart the resolver 

sudo systemctl restart systemd-resolved

Then you can test like this:

$ nslookup google.com

Non-authoritative answer:
Name:   google.com
Name:   google.com
Address: 2607:f8b0:4005:807::200e

$ nslookup mywindowsmachine
;; Got SERVFAIL reply from, trying next server

Name:   mywindowsmachine
;; Got SERVFAIL reply from, trying next server

If the above still doesn't work, try installing winbind. 

sudo apt install winbind libnss-winbind