對於我的組織,我正在為我們的一個專案建立 GitLab CI/CD 管道。此管道中的一項作業將在我們自己的伺服器之一上執行的 Docker 執行器 GitLab 運行器上執行。這項工作涉及將形象docker:20.10.20
與服務結合docker:20.10.20-dind
。目標是從我的專案建立一個 Docker 映像,並將其上傳到專案的容器註冊表中託管在 gitlab.com 本身上(因此不在 Amazon ECR 上)。我已經啟動並運行了以下作業配置.gitlab-ci.yml
:
docker-image-build:
stage: Docker image build
image: docker:20.10.20
services:
- name: docker:20.10.20-dind
alias: docker
tags:
- docker-runner
script:
- echo $CI_REGISTRY_PASSWORD | docker login -u $CI_REGISTRY_USER $CI_REGISTRY --password-stdin
- docker build --pull -m 3g --memory-swap -1 -t $CI_REGISTRY_IMAGE --build-arg FOO=$FOO --build-arg BAR=$BAR .
- docker push $CI_REGISTRY_IMAGE
但是,在docker login
命令中script
我收到與網路安全相關的警告:
Login Succeeded
WARNING! Your password will be stored unencrypted in /root/.docker/config.json.
Configure a credential helper to remove this warning. See
https://docs.docker.com/engine/reference/commandline/login/#credentials-store
將未加密的憑證儲存在可能會留下來的人工製品中對我們來說是一個大問題,因為我們非常擔心網路安全。但是我似乎找不到安裝方法docker-憑證-helpers在 docker-in-docker 容器中。 (我想或認為我必須使用pass```` based credential helper.) It seems to be a very barebone Linux image without a package manager or compiler. It only has tools such as wget and tar, so I could be able to download binaries and I can in fact install the
docker-credential-pass binary itself. But I'm mostly stuck with no way to get
pass installed, let alone its dependency
gpg``` 以及足夠的熵源。
我被困住了,不知道如何繼續。任何建議將不勝感激。在這種情況下我應該切換到 shell 執行器嗎?
先感謝您!
約書亞