File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change 104
104
dockerfile=" $DIR /build/docker/$image .Dockerfile"
105
105
tagname=" aspnetcore-build-$image "
106
106
107
+ # Use docker pull with retries to pre-pull the image need by the dockerfile
108
+ # docker build regularly fails with TLS handshake issues for unclear reasons.
109
+ base_imagename=" $( grep -E -o ' FROM (.*)' $dockerfile | cut -c 6-) "
110
+ pull_retries=3
111
+ while [ $pull_retries -gt 0 ]; do
112
+ failed=false
113
+ docker pull $base_imagename || failed=true
114
+ if [ " $failed " = true ]; then
115
+ let pull_retries=pull_retries-1
116
+ echo -e " ${YELLOW} Failed to pull $base_imagename Retries left: $pull_retries .${RESET} "
117
+ sleep 1
118
+ else
119
+ pull_retries=0
120
+ fi
121
+ done
122
+
107
123
docker build " $( dirname " $dockerfile " ) " \
108
124
--build-arg " USER=$( whoami) " \
109
125
--build-arg " USER_ID=$( id -u) " \
You can’t perform that action at this time.
0 commit comments