我知道Stackoverflow上有很多关于这个或类似话题的帖子。然而,这些显然都不能解决我的问题。我尝试使用Travis-ci构建和推送docker镜像。标记实际上工作正常。
$ docker build -t $DOCKER_USERNAME/$IMAGETAG ./linux/jenkins/
...
Successfully tagged papanito/jenkins:latest
但是,推送不起作用,因为它会抱怨缺少本地标签
...
$ export IMAGETAG=jenkins:latest
$ docker login -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD"
WARNING! Using --password via the CLI is insecure. Use --password-stdin.
Login Succeeded
The command "docker login -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD"" exited with 0.
$ docker push $DOCKER_USERNAME/$IMAGETAG
The push refers to a repository [docker.io/papanito/jenkins]
An image does not exist locally with the tag: papanito/jenkins
...
有趣的是,最后一条消息没有包含版本信息:latest。这里有什么问题?
发布于 2018-10-23 03:32:56
我的问题实际上是我将docker镜像的“构建”和“部署”分成了两个不同的阶段。因此,第二阶段并不知道图像。如果我将所有内容放在一个阶段中,则图像上传成功。
https://stackoverflow.com/questions/52913448
复制相似问题