Docker Error: Service 'web' Failed to Build

I am attempting to build a docker container from a makefile using the command ‘make dev’, and it keeps giving me this error:

PS C:\Users\johns\OneDrive\documents\GitHub\sidewalkwebpage> make dev
projectsidewalk-db is up-to-date
Starting projectsidewalk-db ... done                                                                                    Building web
Step 1/9 : FROM openjdk:8-jdk-stretch
 ---> f8146facf376
Step 2/9 : RUN curl -sL https://deb.nodesource.com/setup_10.x | bash - &&   apt-get install -y nodejs
 ---> Using cache
 ---> 65f47a0f2d08
Step 3/9 : RUN echo "deb https://dl.bintray.com/sbt/debian /" | tee -a /etc/apt/sources.list.d/sbt.list &&   apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 2EE0EA64E40A89B84B2DF73499E82A75642AC823 &&   apt-get update
 ---> Running in 6a211a40458d
deb https://dl.bintray.com/sbt/debian /
Warning: apt-key output should not be parsed (stdout is not a terminal)
Executing: /tmp/apt-key-gpghome.aruCwsH8eR/gpg.1.sh --keyserver hkp://keyserver.ubuntu.com:80 --recv 2EE0EA64E40A89B84B2DF73499E82A75642AC823
gpg: keyserver receive failed: Server indicated a failure
ERROR: Service 'web' failed to build: The command '/bin/sh -c echo "deb https://dl.bintray.com/sbt/debian /" | tee -a /etc/apt/sources.list.d/sbt.list &&   apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 2EE0EA64E40A89B84B2DF73499E82A75642AC823 &&   apt-get update' returned a non-zero code: 2
make: *** [docker-run] Error 1

I have tried a lot of fixes on my own and from Google but nothing seems to work. Any thoughts on what to do would be helpful! Here is a link to the GitHub repository which has the files being used to create the container: https://github.com/ProjectSidewalk/SidewalkWebpage

Keyservers often don’t respond to queries. There are different workarounds. I got the best results when I call different servers, like here.

Thanks for the response! I’m pretty new to Docker, so what would I add to my Dockerfile to call a different server?

It’s not Docker, it’s just bash. Instead of apt-key adv you add a block like the one in my example, this means something like the following:

  && export GNUPGHOME="$(mktemp -d)" \
  && for key in \
    2EE0EA64E40A89B84B2DF73499E82A75642AC823 \
  ; do \
    gpg --batch --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys "$key" || \
    gpg --batch --keyserver hkp://ipv4.pool.sks-keyservers.net --recv-keys "$key" || \
    gpg --batch --keyserver hkp://pgp.mit.edu:80 --recv-keys "$key" ; \
  done \
  && gpg --batch --export 2EE0EA64E40A89B84B2DF73499E82A75642AC823 > /etc/apt/trusted.gpg.d/sbt_build_tool.gpg \
  && command -v gpgconf > /dev/null && gpgconf --kill all \
  && rm -rf "$GNUPGHOME" \

Warning: Not tested!
You don’t call a different server, but try a second or third one if the others fail. You can add the Ubuntu server to the list too, if you want.

Could you edit the document from the repository I linked and paste it here? I’m having trouble understanding.

In the Dockerfile replace

RUN echo "deb https://dl.bintray.com/sbt/debian /" | tee -a /etc/apt/sources.list.d/sbt.list && \
  apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 2EE0EA64E40A89B84B2DF73499E82A75642AC823 && \
  apt-get update

with

RUN echo "deb https://dl.bintray.com/sbt/debian /" | tee -a /etc/apt/sources.list.d/sbt.list \
  && export GNUPGHOME="$(mktemp -d)" \
  && for key in \
    2EE0EA64E40A89B84B2DF73499E82A75642AC823 \
  ; do \
    gpg --batch --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys "$key" || \
    gpg --batch --keyserver hkp://ipv4.pool.sks-keyservers.net --recv-keys "$key" || \
    gpg --batch --keyserver hkp://pgp.mit.edu:80 --recv-keys "$key" ; \
  done \
  && gpg --batch --export 2EE0EA64E40A89B84B2DF73499E82A75642AC823 > /etc/apt/trusted.gpg.d/sbt_build_tool.gpg \
  && command -v gpgconf > /dev/null && gpgconf --kill all \
  && rm -rf "$GNUPGHOME" \
  && apt-get update

Once again what I write here is not tested.

It gave me the same error:

ERROR: Service 'web' failed to build: The command '/bin/sh -c echo "deb https://dl.bintray.com/sbt/debian /" | tee -a /etc/apt/sources.list.d/sbt.list   && export GNUPGHOME="$(mktemp -d)"   && for key in     2EE0EA64E40A89B84B2DF73499E82A75642AC823   ; do     gpg --batch --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys "$key" ||     gpg --batch --keyserver hkp://ipv4.pool.sks-keyservers.net --recv-keys "$key" ||     gpg --batch --keyserver hkp://pgp.mit.edu:80 --recv-keys "$key" ;   done   && gpg --batch --export 2EE0EA64E40A89B84B2DF73499E82A75642AC823 > /etc/apt/trusted.gpg.d/sbt_build_tool.gpg   && command -v gpgconf > /dev/null && gpgconf --kill all   && rm -rf "$GNUPGHOME"   && apt-get update' returned a non-zero code: 2
make: *** [docker-run] Error 1

It’s not the same, it just looks the same. :wink:
This is a bit strange because if I paste the whole command into an openjdk-8 container it works fine and gpg gives me this output:

gpg: key 99E82A75642AC823: public key "sbt build tool <scalasbt@gmail.com>" imported
gpg: Total number processed: 1
gpg:               imported: 1

Maybe you could try the same?

Ok, I’m giving me this new error:

PS C:\Users\johns\OneDrive\documents\GitHub\sidewalkwebpage> make dev
Starting projectsidewalk-db ... error                                                                                   
ERROR: for projectsidewalk-db  Cannot start service db: network 1e688616f9e710bff7e65d659903f5e7d3bcbad5d7fce1c2ccf670703d727a83 not found

ERROR: for db  Cannot start service db: network 1e688616f9e710bff7e65d659903f5e7d3bcbad5d7fce1c2ccf670703d727a83 not found
ERROR: Encountered errors while bringing up the project.
make: *** [docker-up-db] Error 1

It’s saying something about not being able to start service db, but I don’t know what that means.