Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/drupal/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
BitBucket管道-docker未经授权:需要身份验证-docker推送成功登录_Docker_Bitbucket_Bitbucket Pipelines - Fatal编程技术网

BitBucket管道-docker未经授权:需要身份验证-docker推送成功登录

BitBucket管道-docker未经授权:需要身份验证-docker推送成功登录,docker,bitbucket,bitbucket-pipelines,Docker,Bitbucket,Bitbucket Pipelines,此问题适用于Bitbucket管道。我已经看到了其他相关的问题,坦率地说,Bitbucket yaml和Dockerfile脚本在直接在bash终端中执行时工作得非常好 就在执行管道时,它在成功登录后立即失败 这是我的Yaml文件: # enable Docker for the repository options: docker: true # Start the pipeline pipelines: default: - step: script: #

此问题适用于Bitbucket管道。我已经看到了其他相关的问题,坦率地说,Bitbucket yaml和Dockerfile脚本在直接在bash终端中执行时工作得非常好

就在执行管道时,它在成功登录后立即失败

这是我的Yaml文件:

# enable Docker for the repository
options:
  docker: true

# Start the pipeline
pipelines:
  default:
    - step:
        script: # Name the image and create a docker image
          - docker build -t "my_docker_id/my_app:latest" . 
          - docker login --username $DOCKER_HUB_USERNAME --password $DOCKER_HUB_PASSWORD
          - docker push my_docker_id/my_app:latest
我的Dockerfile看起来像:

FROM ubuntu:latest

# Install Python and related tools
RUN apt-get update && apt-get install -y --no-install-recommends apt-utils
RUN apt-get -y upgrade
RUN apt-get install -y python3
RUN apt-get install -y python3-pip
RUN pip3 install --upgrade pip

# Now use Pip to install Flask
RUN pip3 install flask

# Set the working directory to Ubuntu user home
WORKDIR /home/ubuntu

# Then copy the website folder to home folder
COPY . /home/ubuntu
docker登录成功:

docker login --username $DOCKER_HUB_USERNAME --password $DOCKER_HUB_PASSWORD<1s
Login Succeeded
在以下情况下失败:

+docker push cbrodock/corpsite:最新版本
推送引用存储库[docker.io/cbrodock/corpsite]
bdca855fbe4a:准备
d147d767df7b:准备
f6aad432f761:准备
0da658ad5264:正在准备
84e11e4ededf:准备
50FD2588DAD:正在准备
2cb0a11f65e0:准备
ad8ba289abb4:准备
33f1a94ed7fc:准备
b27287a6dbce:准备
47c2386f248c:准备
2be95f0d8a0c:准备
2df9b8def18a:准备
爸爸:等着
47c2386f248c:正在等待
2cb0a11f65e0:等待
33f1a94ed7fc:正在等待
2df9b8def18a:正在等待
b27287a6dbce:等待
2be95f0d8a0c:正在等待
ad8ba289abb4:等待
未经授权:需要身份验证

如果我在MacOS上的bash终端中执行相同的步骤,它们执行得很好,推送成功


有什么想法吗?

可能发生的事情1。您登录的shell和执行push命令的shell可能完全不同。。。您是否尝试
docker登录--username$docker\u HUB\u username--password$docker\u HUB\u password如果上述操作不起作用,请尝试除
最新版本以外的其他标记。相同问题:docker登录--用户名$docker\u HUB\u用户名--密码$docker\u HUB\u密码和docker推送我的docker\u id/my\u应用程序:最新123登录成功…然后出现>>未经授权:需要身份验证
docker push my_docker_id/my_app:latest