gcloud 提交 [存储库] 解析 HTTP 404 响应正文时出错:无效字符 '<' and shows error /blobs/uploads was not found on this server

问题描述 投票:0回答:1

当我运行以下命令时

gcloud builds submit --config docker-build.yml

我在“解析 HTTP 404 响应正文时出错:无效字符”中收到错误<' looking for beginning of value:" in the content of this HTML output and notably with the error showing /blobs/uploads was not found.

label=Google></span></a>\n  <p><b>404.</b> <ins>That’s an error.</ins>\n  <p>The requested URL
<code>/v2/<PROJECT/<REPOSITORY>/<IMAGE>/blobs/uploads/</code> was not found on this server.
<ins>That’s all we know.</ins>\n"

输出显示

Creating temporary archive of 75 file(s) totalling 474.6 KiB before compression.
Uploading tarball of [.] to [gs://<PROJECT>_cloudbuild/source/1727423461.295631-b08f76f9724b4c95b7234a57fb6440da.tgz]
Created [https://cloudbuild.googleapis.com/v1/projects/<PROJECT>/locations/global/builds/5c040439-95cc-42b2-985e-c3baa7bb4562].
Logs are available at [ https://console.cloud.google.com/cloud-build/builds/5c040439-95cc-42b2-985e-c3baa7bb4562?project=156056269609 ].
Waiting for build to complete. Polling interval: 1 second(s).
---------------------------------- REMOTE BUILD OUTPUT -----------------------------------
starting build "5c040439-95cc-42b2-985e-c3baa7bb4562"

FETCHSOURCE
Fetching storage object: gs://<PROJECT>_cloudbuild/source/1727423461.295631-b08f76f9724b4c95b7234a57fb6440da.tgz#1727423463721043
Copying gs://<PROJECT>_cloudbuild/source/1727423461.295631-b08f76f9724b4c95b7234a57fb6440da.tgz#1727423463721043...
/ [1 files][140.2 KiB/140.2 KiB]                                                
Operation completed over 1 objects/140.2 KiB.
SETUPBUILD
BUILD
Already have image (with digest): gcr.io/cloud-builders/docker
Sending build context to Docker daemon  544.8kB
Step 1/11 : FROM python:3-slim
3-slim: Pulling from library/python
a2318d6c47ec: Already exists
e0175c87c1f4: Pulling fs layer
bea1d778e3e0: Pulling fs layer
7ce703381f53: Pulling fs layer
7ce703381f53: Verifying Checksum
7ce703381f53: Download complete
e0175c87c1f4: Verifying Checksum
e0175c87c1f4: Download complete
bea1d778e3e0: Verifying Checksum
bea1d778e3e0: Download complete
e0175c87c1f4: Pull complete
bea1d778e3e0: Pull complete
7ce703381f53: Pull complete
Digest: sha256:15bad989b293be1dd5eb26a87ecacadaee1559f98e29f02bf6d00c8d86129f39
Status: Downloaded newer image for python:3-slim
 ---> 0d8d642b665d
Step 2/11 : ENV PYTHONDONTWRITEBYTECODE=1
 ---> Running in 726520ca2762
Removing intermediate container 726520ca2762
 ---> 37395f7b9679
Step 3/11 : ENV PYTHONUNBUFFERED=1
 ---> Running in 0773f4d9bbe5
Removing intermediate container 0773f4d9bbe5
 ---> 6a88543b2f71
Step 4/11 : COPY shared_python-1.20.23-py3-none-any.whl .
 ---> 28d1f6ad0279
Step 5/11 : COPY requirements.txt .
 ---> 2204c82ae3fb
Step 6/11 : WORKDIR /app
 ---> Running in 2c6ce56f44fd
Removing intermediate container 2c6ce56f44fd
 ---> 8453deebdb48
Step 7/11 : COPY . /app
 ---> 900a09725435
Step 8/11 : RUN adduser -u 5678 --disabled-password --gecos "" appuser && chown -R appuser /app
 ---> Running in be0c35de84cd
Adding user `appuser' ...
Adding new group `appuser' (5678) ...
Adding new user `appuser' (5678) with group `appuser (5678)' ...
Creating home directory `/home/appuser' ...
Copying files from `/etc/skel' ...
Adding new user `appuser' to supplemental / extra groups `users' ...
Adding user `appuser' to group `users' ...
Removing intermediate container be0c35de84cd
 ---> 9d8be7a7dce3
Step 9/11 : USER appuser
 ---> Running in dde09a1b0c8d
Removing intermediate container dde09a1b0c8d
 ---> 2725ea2a6ccf
Step 10/11 : EXPOSE 8080
 ---> Running in c8a1c1e0b5c8
Removing intermediate container c8a1c1e0b5c8
 ---> 5ad3b8e5c7fc
Step 11/11 : CMD ["gunicorn", "--bind", "0.0.0.0:8080",  "--timeout" "900", "main"]
 ---> Running in 7b005453ceeb
Removing intermediate container 7b005453ceeb
 ---> 30605e16b975
Successfully built 30605e16b975
Successfully tagged europe-west2-b-docker.pkg.dev/<PROJECT/<REPOSITORY>/<IMAGE>:latest
PUSH
Pushing europe-west2-b-docker.pkg.dev/<PROJECT/<REPOSITORY>/<IMAGE>
The push refers to repository [europe-west2-b-docker.pkg.dev/<PROJECT/<REPOSITORY>/<IMAGE>]
bc7dff04434c: Preparing
060a2030295f: Preparing
50f1b4274077: Preparing
5eaa022b8a05: Preparing
d03c932f1afe: Preparing
5c5b1cd04947: Preparing
ecfc14c16318: Preparing
de732417db5d: Preparing
8e2ab394fabf: Preparing
5c5b1cd04947: Waiting
ecfc14c16318: Waiting
de732417db5d: Waiting
8e2ab394fabf: Waiting
error parsing HTTP 404 response body: invalid character '<' looking for beginning of value: "<!DOCTYPE html>\n<html lang=en>\n  <meta charset=utf-8>\n  <meta name=viewport content=\"initial-scale=1, minimum-scale=1, width=device-width\">\n  <title>Error 404 (Not Found)!!1</title>\n  
...
-label=Google></span></a>\n  <p><b>404.</b> <ins>That’s an error.</ins>\n  <p>The requested URL <code>/v2/<PROJECT/<REPOSITORY>/<IMAGE>/blobs/uploads/</code> was not found on this server.  <ins>That’s all we know.</ins>\n"

docker-build.yml

steps:
- name: 'gcr.io/cloud-builders/docker'
  script: |
    docker build . -t europe-west2-b-docker.pkg.dev/<PROJECT/<REPOSITORY>/<IMAGE>:latest
  automapSubstitutions: false
images:
- 'europe-west2-b-docker.pkg.dev/<PROJECT/<REPOSITORY>/<IMAGE>:latest'

docker-compose.yml

version: '3.4'

services:
  orderprocessinglinnworksapiproxy:
    image: europe-west2-b-docker.pkg.dev/<PROJECT/<REPOSITORY>/<IMAGE>:latest
    build:
      context: .
      target: builder
      dockerfile: ./Dockerfile
    environment:
      - ERROR_LOG_DIR=${ERROR_LOG_DIR}
      - FLASK_APPLICATION_KEY=${FLASK_APPLICATION_KEY}
      - PYTHONPATH=$PYTHONPATH:/app:/app/
    
    # flask requires SIGINT to stop gracefully
    # (default stop signal from Compose is SIGTERM)
    stop_signal: SIGINT
    network_mode: host
    ports:
      - '8080:8080'
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock

Dockerfile

# For more information, please refer to https://aka.ms/vscode-docker-python
FROM python:3-slim


# Keeps Python from generating .pyc files in the container
ENV PYTHONDONTWRITEBYTECODE=1

# Turns off buffering for easier container logging
ENV PYTHONUNBUFFERED=1

# Install pip requirement

COPY shared_python-1.20.23-py3-none-any.whl .
COPY requirements.txt .
#RUN python -m pip install -r requirements.txt

WORKDIR /app
COPY /src /app

# Creates a non-root user with an explicit UID and adds permission to access the /app folder
# For more info, please refer to https://aka.ms/vscode-docker-python-configure-containers
RUN adduser -u 5678 --disabled-password --gecos "" appuser && chown -R appuser /app
USER appuser

EXPOSE 8080

# During debugging, this entry point will be overridden. For more information, please refer to https://aka.ms/vscode-docker-python-debug
CMD ["gunicorn", "--bind", "0.0.0.0:8080",  "--timeout" "900", "main"]

创建存储库并准备源代码

  1. 创建存储库
gcloud artifacts repositories create docker-repo --repository-format=docker --location=europe-west2
  1. 获取源代码
pwd
git clone https://github.com/.../<SOLUTION>.git -b <BRANCH>
cd <SOLUTION>
rm -rf .git
docker dockerfile gcloud google-artifact-registry
1个回答
0
投票

我从图像路径中删除了区域“-b”。

europe-west2-b-docker.pkg.dev/

...应该是...

europe-west2-docker.pkg.dev/

© www.soinside.com 2019 - 2024. All rights reserved.