嗨,我正在努力 docker push
[docker-simple-httpserver]# docker push myregistry/simplehttpserver:latest The push refers to a repository [myregistry/simplehttpserver] (len: 1) Sending image list FATA[0000] Error: Status 403 trying to push repository simplehttpserver: "{\"error\": \"Unauthorized updating repository images\"}"
是有我的方式来指定username
,并password
在docker push
命令?
我认为出于安全原因,他们会将密码保留在命令行之外.
这样做的方法是先登录然后再按.
https://docs.docker.com/mac/step_six/
$ docker login --username=maryatdocker --email=mary@docker.com Password: WARNING: login credentials saved in C:\Users\sven\.docker\config.json Login Succeeded
然后推
$ docker push maryatdocker/docker-whale The push refers to a repository [maryatdocker/docker-whale] (len: 1) 7d9495d03763: Image already exists c81071adeeb5: Image successfully pushed
通常,您可以使用交互式指定密码,docker login
然后执行a docker push
.
对于非交互式登录,您可以使用-u
和-p
标志.
docker login -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD"
Docker构建的Travis CI文档提供了如何自动化docker登录的示例.
有关详细信息,请参阅docker login.