Rootless Docker No Internet Access

When building docker images or trying to curl even IP’s on my LAN docker doesn’t appear to have any network connection.

If I build with --host things work. One of the reasons I need to use docker and not podman is for buildx bake support for a work project.

I’ve tried setting these

sudo sysctl -w net.ipv4.ip_forward=1
sudo sysctl -w net.ipv6.conf.all.forwarding=1
{ pkgs, lib, ... }:
{
  # Enable common container config files in /etc/containers
  virtualisation.containers.enable = true;
  virtualisation = {
    docker = {
      enable = lib.mkForce false;
      rootless = {
        enable = true;
        setSocketVariable = true;
        daemon.settings = {
          dns = [ "1.1.1.1" "8.8.8.8" ];
          #registry-mirrors = [ "https://mirror.gcr.io" ];
          experimental = true;
          features = {
            buildkit = true;
            
          };
        };
      };
      
    };
  };

  # Useful other development tools
  environment.systemPackages = with pkgs; [
    dive # look into docker image layers
    podman-tui # status of containers in the terminal
    docker-compose # start group of containers for dev
    #podman-compose # start group of containers for dev
  ];
}

Hmm I restarted systemctl --user restart docker.service and it does appear to be working now.

I added

  # Needed for default bridge network to automatically work
  boot.kernel.sysctl."net.ipv4.ip_forward" = 1;
  boot.kernel.sysctl."net.ipv6.ip_forward" = 1;

I susspect this is related to NetworkManager?