E: gnupg, gnupg2 and gnupg1 do not seem to be installed, but one of them is required for this operation

I have installed docker on windows 10 pro. I am facing an issue while running the following command in git-bash.

docker-compose up -d --build

and got following error.

E: gnupg, gnupg2 and gnupg1 do not seem to be installed, but one of them is required for this operation
(23) Failed writing body
Error executing command, exiting
ERROR: Service 'web' failed to build: The command '/bin/sh -c curl -sL https://deb.nodesource.com/setup_8.x | bash' returned a non-zero code: 1

In your Dockerfile, run this first:

apt-get update && apt-get install -y gnupg2

or

apt-get update && apt-get install -y gnupg

I faced the same issue:

E: gnupg, gnupg2 and gnupg1 do not seem to be installed, but one of them is required for this operation

I resolved by using the following commands:

apt-get update
apt-get install gnupg

In addition to existing answers:

RUN apt-get update && apt-get install -y gnupg

-y flag agrees to terms during installation process. It is important not to break the build