Raj*_*jan 2 virtualbox fedora docker
我在Fedora 25中安装了Docker CE。
当我尝试使用以下命令登录docker hub时出现错误。
$ docker login --username xxx --password yyy https://hub.docker.com/
WARNING! Using --password via the CLI is insecure. Use --password-stdin.
Error response from daemon: login attempt to
https://hub.docker.com/v2/ failed with status: 404 Not Found
$ docker --version
Docker version 17.07.0-ce, build 8784753
$ docker-machine --version
docker-machine version 0.12.2, build 9371605
Run Code Online (Sandbox Code Playgroud)
请注意,相同的命令在Ubuntu 16.04中也能正常工作,只有我能想到的区别是ubuntu具有docker,而fedora具有docker-ce。
不知道为什么我仅在Fedora上收到此错误。在虚拟机VM上安装Fedora时出现此错误。
如果它是hub.docker.com,则无需指定注册表。
docker login --username xxx --password yyy
Run Code Online (Sandbox Code Playgroud)
使用上面的命令不带URL,它应该可以工作
在为Docker应用程序设置Jenkins管道时,我遇到了类似的问题。
问题是我在 Jenkinsfile构建阶段使用https://hub.docker.com作为Docker 的注册表:
stage('Push image') {
/* Finally, we'll push the image with two tags:
* First, the incremental build number from Jenkins
* Second, the 'latest' tag.
* Pushing multiple tags is cheap, as all the layers are reused. */
docker.withRegistry('https://hub.docker.com', 'Dockerhub') {
app.push("${env.BUILD_NUMBER}")
app.push("latest")
}
}
Run Code Online (Sandbox Code Playgroud)
这是我修复它的方法:
我只需将 docker注册表从https://hub.docker.com修改为https://registry.hub.docker.com:
stage('Push image') {
/* Finally, we'll push the image with two tags:
* First, the incremental build number from Jenkins
* Second, the 'latest' tag.
* Pushing multiple tags is cheap, as all the layers are reused. */
docker.withRegistry('https://registry.hub.docker.com', 'Dockerhub') {
app.push("${env.BUILD_NUMBER}")
app.push("latest")
}
}
Run Code Online (Sandbox Code Playgroud)
然后是Jenkins配置中的Dockerhub凭据:
username: my_username (not my email address)
password: my_password
Run Code Online (Sandbox Code Playgroud)
就这样。
我希望这有帮助。
| 归档时间: |
|
| 查看次数: |
4876 次 |
| 最近记录: |