Reputation: 327
When I try to execute docker build -t exampledockeracc/testapp:v1.0.0 .
I receive the following error: failed to dial gRPC: unable to upgrade to h2c, received 500, context canceled
When i search for the error people come with the solution to restart docker and waite a while before executing but it does not seem to work.
I've read something about an OS mismatch between target OS specified in dockerfile and curretnlly running container OS on you machine. I am using windows.
This is my dockerfile:
#############
### build ###
#############
# base image
FROM node:12.2.0 as build
# install chrome for protractor tests
RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -
RUN sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list'
RUN apt-get update && apt-get install -yq google-chrome-stable
# set working directory
WORKDIR /app
# add `/app/node_modules/.bin` to $PATH
ENV PATH /app/node_modules/.bin:$PATH
# install and cache app dependencies
COPY ./package.json /app/package.json
RUN npm install
RUN npm install -g @angular/[email protected]
# add app
COPY . /app
# run tests
# RUN ng test --watch=false
# RUN ng e2e --port 4202
# generate build
RUN ng build --output-path=dist --prod="true"
############
### prod ###
############
# base image
FROM nginx:alpine
# copy artifact build from the 'build environment'
COPY --from=build /app/dist /usr/share/nginx/html
COPY --from=build /app/nginx.conf /etc/nginx/conf.d/default.conf
# expose port 80
EXPOSE 80
# run nginx
CMD ["nginx", "-g", "daemon off;"]
It is used for an Angular application.
Upvotes: 11
Views: 12786
Reputation: 13496
This issue is caused because you have not let the Docker enough time to load completely. Please wait for some time and try again.
One other reason is OS mismatch. The node image is Linux-based and you are on windows. I would recommend you, get a Linux server or a VM for building the containers.
Upvotes: 9