我在ci cd管道中开始构建docker映像,并且在"构建"步骤中由于未知的原因没有通过授权,并给出一个错误:
Configure a credential helper to remove this warning. See
https://docs.docker.com/engine/reference/commandline/login/#credentials-store
Login Succeeded
$ docker login --username=$HEROKU_USER --password=$HEROKU_API_KEY registry.heroku.com
WARNING! Using --password via the CLI is insecure. Use --password-stdin.
Error response from daemon: login attempt to https://registry.heroku.com/v2/ failed with status: 401 Unauthorized
Cleaning up project directory and file based variables
ERROR: Job failed: exit code 1
有没有人遇到这种情况,可以帮助?因为我还在学习CI СD。甚至可能是一个愚蠢的错误,因为我在这方面缺乏知识和能力。
我的<<p> strong> docker-compose.yml :version: "3.3"
services:
beranking-api:
container_name: beranking-api
ports:
- 8000:80
- 8001:443
depends_on:
- "postgres"
build:
context: .
dockerfile: BBS.Api/Dockerfile
environment:
- ASPNETCORE_URLS=https://+;http://+
- ASPNETCORE_Kestrel__Certificates__Default__Password=certificate
- ASPNETCORE_Kestrel__Certificates__Default__Path=/https/certificate.pfx
volumes:
- ~/.aspnet/https:/https:ro
networks:https://stackoverflow.com/questions/ask#
- beranking-network
postgres:
container_name: postgres
ports:
- "5432"
restart: always
build:
context: .
dockerfile: BBS.DataAccess/Dockerfile
environment:
POSTGRES_USER: "testing"
POSTGRES_PASSWORD: "testing"
POSTGRES_DB: "testing"
networks:
- beranking-network
networks:
beranking-network:
driver: bridge
这个问题与你的docker-compose文件无关——它与你的命令直接相关:
docker login --username=$HEROKU_USER --password=$HEROKU_API_KEY registry.heroku.com
当以这种方式使用密码配置时,它仍然记录变量$HEROKU_API_KEY
的输出将被保存到:
WARNING! Your password will be stored unencrypted in your/path/.docker/config.json.
我不完全熟悉heroku,但是这个问题可以在Gitlab上通过以下操作来解决:
echo "$HEROKU_API_KEY" | docker login --username foo --password-stdin
您也可以使用docker中的凭据存储-更多信息在这里:
https://docs.docker.com/engine/reference/commandline/login/credentials-store
Docker:通过CLI使用——password是不安全的。使用——password-stdin