Glibc libraries aren't correctly symlinked while building docker images via `dockerTools`

I am trying to build a python base image with opencv and its dependencies installed. All the dependencies except glib’s libraries are correctly present in the /lib/ directory. For now, I have to manually symlink LD_LIBRARY_PATH=/nix/store/24lgqdbdzy31k0i2dh6s51g2ayy6cpyl-glib-2.68.2/lib/ to make everything work but not sure why only glib’s libraries are not getting symlinked.

Any help is really appreciated!

with import <nixpkgs> {};

let
  dockerEtc = runCommand "docker-etc" {} ''
    mkdir -p $out/etc/pam.d

    echo "root:x:0:0::/root:/bin/bash" > $out/etc/passwd
    echo "root:!x:::::::" > $out/etc/shadow
    echo "root:x:0:" > $out/etc/group
  '';

  my-opencv = opencv4.override {
    enableGtk2 = true;
    gtk2 = pkgs.gtk2;
    enableFfmpeg = true; #here is how to add ffmpeg and other compilation flags
    ffmpeg = pkgs.ffmpeg;
  };

  pythonBase = dockerTools.buildLayeredImage {
    name = "python38-base-image-unwrapped";
    created = "123";
    maxLayers = 2;
    contents = [
      bashInteractive
      coreutils
      findutils
      python38
      gtk3
      freeglut
      my-opencv
      libGL
      libGLU
      python38Packages.pyopengl
      mesa
      zlib
      stdenv.cc.cc.lib
      iana-etc
      cacert
      dockerEtc
      ripgrep
      libglvnd
      gcc
      gnumake
      zlib
      glib
      glibc
      libdrm
      glibc.static
    ];
    extraCommands = ''
      mkdir -p root
      mkdir -p usr/bin
      ln -s /bin/env usr/bin/env
      cat <<-"EOF" > "usr/bin/python3"
#!/bin/sh
export LD_LIBRARY_PATH="/lib64:/lib:/nix/store/24lgqdbdzy31k0i2dh6s51g2ayy6cpyl-glib-2.68.2/lib/";
echo $LD_LIBRARY_PATH
exec -a "$0" "/bin/python3" "$@"
EOF
      chmod +x usr/bin/python3
      ln -s /usr/bin/python3 usr/bin/python
    '';
  };
  # rules_nixpkgs require the nix output to be a directory,
  # so we create one in which we put the image we've just created
in runCommand "python38-base-image" { } ''
  mkdir -p $out
  gunzip -c ${pythonBase} > $out/image
''