自訂 docker 檔案導致 Appengine 部署失敗

自訂 docker 檔案導致 Appengine 部署失敗

我正在嘗試使用自訂 docker 檔案在 appengine 上部署我的 vue.js 程式碼,但出現錯誤 The docker file is work well on my local machine。誰能告訴我有什麼問題嗎?

這是我的 docker 文件

FROM node:9.11.1-alpine as build-stage
WORKDIR /app
COPY package*.json ./
RUN npm install
COPY . .
RUN npm run build
# production stage
FROM nginx:1.13.12-alpine as production-stage
COPY nginx/default.conf /etc/nginx/conf.d/
COPY --from=build-stage /app/dist /usr/share/nginx/html
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]

這是我的 app.yaml

# application: lifeprint2-1222
service: admin-panel
env: flex
runtime: custom
network:
 forwarded_ports:
   - 80:80
# eof

以下是部署程式碼時的錯誤詳細資訊:

Updating service [admin-panel] (this may take several minutes)...⠛DEBUG: Operation [apps/lifeprint2demo/operations/e858191d-28bd-4ce6-b7cc-6f6ea751ed6f] not complete. Waiting to retry.
Updating service [admin-panel] (this may take several minutes)...⠹DEBUG: Operation [apps/lifeprint2demo/operations/e858191d-28bd-4ce6-b7cc-6f6ea751ed6f] complete. Result: {
    "metadata": {
        "user": "[email protected]", 
        "target": "apps/lifeprint2demo/services/admin-panel/versions/20180902t214321", 
        "@type": "type.googleapis.com/google.appengine.v1.OperationMetadataV1", 
        "insertTime": "2018-09-02T16:46:35.958Z", 
        "method": "google.appengine.v1.Versions.CreateVersion"
    }, 
    "done": true, 
    "name": "apps/lifeprint2demo/operations/e858191d-28bd-4ce6-b7cc-6f6ea751ed6f", 
    "error": {
        "message": "An internal error occurred during deployment.", 
        "code": 13
    }
}
Updating service [admin-panel] (this may take several minutes)...failed.                                                                                        
DEBUG: (gcloud.app.deploy) Error Response: [13] An internal error occurred during deployment.
Traceback (most recent call last):
  File "/Users/nomanmaqsood/google-cloud-sdk/lib/googlecloudsdk/calliope/cli.py", line 839, in Execute
    resources = calliope_command.Run(cli=self, args=args)
  File "/Users/nomanmaqsood/google-cloud-sdk/lib/googlecloudsdk/calliope/backend.py", line 770, in Run
    resources = command_instance.Run(args)
  File "/Users/nomanmaqsood/google-cloud-sdk/lib/surface/app/deploy.py", line 90, in Run
    parallel_build=False)
  File "/Users/nomanmaqsood/google-cloud-sdk/lib/googlecloudsdk/command_lib/app/deploy_util.py", line 598, in RunDeploy
    flex_image_build_option=flex_image_build_option)
  File "/Users/nomanmaqsood/google-cloud-sdk/lib/googlecloudsdk/command_lib/app/deploy_util.py", line 407, in Deploy
    extra_config_settings)
  File "/Users/nomanmaqsood/google-cloud-sdk/lib/googlecloudsdk/api_lib/app/appengine_api_client.py", line 207, in DeployService
    poller=done_poller)
  File "/Users/nomanmaqsood/google-cloud-sdk/lib/googlecloudsdk/api_lib/app/operations_util.py", line 315, in WaitForOperation
    sleep_ms=retry_interval)
  File "/Users/nomanmaqsood/google-cloud-sdk/lib/googlecloudsdk/api_lib/util/waiter.py", line 254, in WaitFor
    sleep_ms, _StatusUpdate)
  File "/Users/nomanmaqsood/google-cloud-sdk/lib/googlecloudsdk/api_lib/util/waiter.py", line 316, in PollUntilDone
    sleep_ms=sleep_ms)
  File "/Users/nomanmaqsood/google-cloud-sdk/lib/googlecloudsdk/core/util/retry.py", line 229, in RetryOnResult
    if not should_retry(result, state):
  File "/Users/nomanmaqsood/google-cloud-sdk/lib/googlecloudsdk/api_lib/util/waiter.py", line 310, in _IsNotDone
    return not poller.IsDone(operation)
  File "/Users/nomanmaqsood/google-cloud-sdk/lib/googlecloudsdk/api_lib/app/operations_util.py", line 184, in IsDone
    encoding.MessageToPyValue(operation.error)))
OperationError: Error Response: [13] An internal error occurred during deployment.
ERROR: (gcloud.app.deploy) Error Response: [13] An internal error occurred during deployment. 

答案1

請讓您的容器按照以下方式偵聽連接埠 8080這個文檔,之後您可以省略forwarded_ports部分。

您想要將 80 轉送到 80 與預設的 80 到 8080 規則相衝突。

乾杯,

米格爾.

相關內容