我试图为我的 Gatsby 应用程序构建我的 Docker 映像。每当我运行命令时 docker build . -t gatsbyapp
,它都会给我一个错误:
failed to solve with frontend dockerfile.v0: failed to build LLB:
failed to compute cache key: "/.env" not found: not found
Run Code Online (Sandbox Code Playgroud)
同时我的 Dockerfile 如下所示:
FROM node:13
WORKDIR /app
COPY package.json .
RUN yarn global add gatsby-cli
RUN yarn install
COPY gatsby-config.js .
COPY .env .
EXPOSE 8000
CMD ["gatsby","develop","-H","0.0.0.0"]
Run Code Online (Sandbox Code Playgroud) 我已将映像推送到 Github 容器注册表 (GHCR) 并将其公开。当我尝试拉它时,出现错误(我已经完成了docker login
)。
docker pull ghcr.io/username/reponame:master
我收到的错误:
Error response from daemon: Head "https://ghcr.io/v2/username/reponame/manifests/master": denied: denied
我找不到有关此错误的太多信息,但这篇文章描述了相同的问题: https: //github.com/orgs/community/discussions/27116。然而,仅仅等待对我来说没有用。
github docker github-package-registry github-container-registry