使用gcloud创建Docker格式Artifact Registry时遇Maven配置不支持错误求助
解决Google Cloud Artifact Registry创建Docker仓库时的"Maven config is not supported"错误
问题重现
执行以下命令创建Docker格式的制品仓库时触发错误:
(venv) PS C:\Users\abc\Python VS code projects\project-name\server> gcloud artifacts repositories create repo-name --repository-format=docker --location=us-central1 --description="Docker repo description"
错误信息:
ERROR: (gcloud.artifacts.repositories.create) INVALID_ARGUMENT: Maven config is not supported for format "DOCKER"
此前使用相同命令一直正常,Dockerfile内容如下(注:此文件与当前错误无关,错误发生在仓库创建阶段):
# run command to install all dependencies RUN pip install Flask gunicorn flask_wtf pyrebase4 firebase_admin httplib2==0.15.0 pycryptodome==3.10.1 # RUN pip install google-auth google-auth-oauthlib google-auth-httplib2 google-api-python-client # now to copy our sourcre code to a folder in the container COPY src/ app/ # and set this container folder to working directory WORKDIR /app # here set environment variable for a port which we set in app.run command in app.py ENV PORT 8080 # run a command for gunicorn where we bind the ports, # set workers to 1, # set threads to 8, # bind the app CMD exec gunicorn --bind :$PORT --workers 1 --threads 8 app:app
解决方法
尝试以下步骤逐个排查:
强制清空Maven配置参数
在创建命令末尾添加--maven-config="",明确告诉CLI不需要Maven相关配置:gcloud artifacts repositories create repo-name --repository-format=docker --location=us-central1 --description="Docker repo description" --maven-config=""重置gcloud的artifacts配置
检查是否有残留的Maven配置默认值,执行以下命令清除:gcloud config unset artifacts.maven_config之后重新运行原创建命令。
更新gcloud CLI到最新版本
旧版本CLI可能存在配置兼容问题,更新后重试:gcloud components update使用无默认配置的命令模式
尝试添加--no-user-output-enabled参数,或者在干净的终端环境(比如退出虚拟环境后)执行命令,排除环境变量干扰。
内容的提问来源于stack exchange,提问作者Haseeb Hassan Asif
相关产品推荐
相关产品推荐

