If the base image has been built with nixpkgs.dockerTools, the image configuration and manifest are readonly so we first need to change their permissions before removing them. Fix #27632.