Docker build fails on RUN apt-get company proxy

Hi,
Recently encountered a wierd issue while installing sentry even after configuring http_proxy, https_proxy values in ~/.docker/config.json, /etc/systemd/system/docker.service.d/http-proxy.conf

 > [4/5] RUN apt-get update && apt-get install -y --no-install-recommends cron &&     rm -r /var/lib/apt/lists/*:
#8 30.83   Unable to connect to myproxy:myport:
#8 30.83 Reading package lists...
#8 30.84 W: Failed to fetch http://deb.debian.org/debian/dists/bullseye/InRelease  Could not connect to myproxy:myport (myproxyIP), connection timed out
#8 30.84 W: Failed to fetch http://deb.debian.org/debian-security/dists/bullseye-security/InRelease  Unable to connect to myproxy:myport:
#8 30.84 W: Failed to fetch http://deb.debian.org/debian/dists/bullseye-updates/InRelease  Unable to connect to myproxy:myport:
#8 30.84 W: Some index files failed to download. They have been ignored, or old ones used instead.
#8 30.85 Reading package lists...
#8 30.86 Building dependency tree...
#8 30.86 Reading state information...
#8 30.86 E: Unable to locate package cron
------
#8 CANCELED
failed to solve: process "/bin/sh -c apt-get update && apt-get install -y --no-install-recommends cron &&     rm -r /var/lib/apt/lists/*" did not complete successfully: exit code: 100
Error in build-docker-images.sh:7.
'$dc build --build-arg "http_proxy=${http_proxy:-}" --build-arg "https_proxy=${https_proxy:-}" --build-arg "no_proxy=${no_proxy:-}" --force-rm' exited with status 17
-> ./install.sh:main:29
--> build-docker-images.sh:source:7

As per my analysis, it looks like the docker is unable to connect to myproxy.
verified that apt-get update && apt-get install -y --no-install-recommends cron && rm -r /var/lib/apt/lists/* works without any issues on the host machine, but fails when docker build command is being run
Would appreciate any help on how to resolve this.