我正在尝试在Jenkins中设置一个流水线来构建镜像并将它们推送到Docker Hub。我的凭据在“Jenkins”管理中被称为“docker-hub-credentials”,似乎已经被使用。
它可以构建,但是无法推送...有帮助吗?我已经花了几个小时在这个问题上,不确定我错过了什么。
我已经尝试过使用docker login,但jenkins不允许它。
stage('Build image') {
/* This builds the actual image; synonymous to
* docker build on the command line */
bat 'docker build -t username/foldername:build . ' }
stage('Push image') {
/* Finally, we'll push the image with two tags:
docker.withRegistry('https://registry.hub.docker.com', 'docker-hub-credentials') {
bat 'docker push username/foldername:build'
}
}
我期望图片被推送,但实际上出现了这个:
The push refers to repository [docker.io/username/foldername]
a73d7d9f4346: Preparing
964bdfb24a54: Preparing
1af124d739c9: Preparing
6cffeea81e5d: Preparing
614a79865f6d: Preparing
612d27bb923f: Preparing
ef68f6734aa4: Preparing
612d27bb923f: Waiting
ef68f6734aa4: Waiting
denied: requested access to the resource is denied
docker login
。 - CalculatingKrakendocker-login
命令。 - CalculatingKraken