簡體   English   中英

Shell 腳本將 docker 圖像推送到 docker 集線器卡住

[英]Shell script to push docker image to docker hub is stuck

I'm trying to push the docker image using the shell script, works fine till login it gets logged in but at push command it gets stuck, when I run docker push command manually it pushes the image but not using shell script.

    #!/bin/bash

    set -x #echo on

    variableA=$(docker build -f test.dockerfile --network=host --no-cache -t myrepo/docker-test . | tail -n1 | cut -d " " -f3)

    echo "$variableA"

    docker ps -a

    echo "$DOCKER_HUB_PWD" | docker login --username="$DOCKER_HUB_UNAME" --password-stdin

    tail -n1

    docker push myrepo/docker-test:latest

    tail -n1

它是由tail -n1引起的。

tail 命令查找輸入文件或數據 stream。

句法:

$ tail [OPTION]... [FILE]...

例子:

$ tail -n1 FILE.TXT
cat FILE.TXT | tail -n1

參考: http://man7.org/linux/man-pages/man1/tail.1.html

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM