diff --git a/pkgs/applications/virtualization/docker/default.nix b/pkgs/applications/virtualization/docker/default.nix
index ac8e5437733..ab1ebc9c04f 100644
--- a/pkgs/applications/virtualization/docker/default.nix
+++ b/pkgs/applications/virtualization/docker/default.nix
@@ -76,7 +76,7 @@ rec {
       extraPath = optionals (stdenv.isLinux) (makeBinPath [ iproute2 iptables e2fsprogs xz xfsprogs procps util-linux git ]);
 
       postPatch = ''
-        patchShebangs .
+        patchShebangs hack/make.sh hack/make/
       '';
 
       buildPhase = ''
@@ -142,7 +142,7 @@ rec {
     ] ++ optionals (buildxSupport) [ docker-buildx ];
 
     postPatch = ''
-      patchShebangs .
+      patchShebangs man scripts/build/
       substituteInPlace ./scripts/build/.variables --replace "set -eu" ""
     '' + optionalString buildxSupport ''
       substituteInPlace ./cli-plugins/manager/manager_unix.go --replace /usr/libexec/docker/cli-plugins \