gpt4 book ai didi

docker - 尝试构建Docker镜像时发生错误:无法调用gRPC:无法升级到H2C,收到500

转载 作者:行者123 更新时间:2023-12-02 20:57:24 29 4
gpt4 key购买 nike

当我尝试执行docker build -t exampledockeracc/testapp:v1.0.0 .时,出现以下错误:failed to dial gRPC: unable to upgrade to h2c, received 500, context canceled
当我搜索错误时,人们提供了重新启动docker并在执行前稍等片刻的解决方案,但这似乎不起作用。

我已经读到一些有关dockerfile中指定的目标操作系统与当前在计算机上运行的容器操作系统之间的操作系统不匹配的信息。我正在使用Windows。

这是我的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/cli@9.0.0

# 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;"]

它用于Angular应用程序。

最佳答案

造成此问题的原因是,您没有让Docker有足够的时间完全加载。请等待一段时间,然后重试。

  • Github Issue Link
  • 关于docker - 尝试构建Docker镜像时发生错误:无法调用gRPC:无法升级到H2C,收到500,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62261552/

    29 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com