invalid from flag value basebuild: pull access denied for basebuild, repository does not exist or may require 'docker logi

12/15/2021

I have built Docker image using below image file

FROM    centos:7 AS base

RUN     yum -y install libgomp && \
        yum clean all;


FROM        base AS build

WORKDIR     /tmp/workdir
RUN     buildDeps="autoconf \
                   automake \
                   bzip2 \
                   bzip2-devel \
                   cmake3 \
                   diffutils \
                   expat-devel \
                   file \
                   gcc \
                   gcc-c++ \
                   git \
                   gperf \
                   libtool \
                   libffi-devel \
                   make \
                   perl \
                   srt-libs \
                   openssl-devel \
                   readline-devel sqlite sqlite-devel openssl-devel xz xz-devel \
                   tar \
                   yasm 

I built with below command

 docker build -t myacr.azurecr.io/buildimage:latest -f Dockerfile-extend .

Now I want to use build image and in another Docker image file

I tried like this

FROM myacr.azurecr.io/buildimage:latest
ENV LD_LIBRARY_PATH=/usr/local/lib64:/usr/local/lib

COPY --from=build /usr/local/ /usr/local/

#Copy code
COPY . /app/
WORKDIR /app

and I am getting below error:

docker build -t myacr.azurecr.io/app1:latest -f Dockerfile-extend .
Sending build context to Docker daemon  26.75MB
Step 1/9 : FROM myacr.azurecr.io/buildimage:latest
 ---> cc0b03a03c8b
Step 2/9 : ENV LD_LIBRARY_PATH=/usr/local/lib64:/usr/local/lib
 ---> Using cache
 ---> 927e26c14864
Step 3/9 : COPY --from=basebuild /usr/local/ /usr/local/
invalid from flag value basebuild: pull access denied for basebuild, repository does not exist or may require 'docker login': denied: requested access to the resource is denied

How to fix ?

-- Vidya
azure
docker
kubernetes
linux
registry

1 Answer

12/16/2021

I did a change in your code and run in my environment.it is working for me. Please Use the below code.

FROM myacr.azurecr.io/buildimage:latest
ENV LD_LIBRARY_PATH=/usr/local/lib64:/usr/local/lib
COPY --from=myacr.azurecr.io/buildimage /usr/local/ /usr/local/
#Copy code
COPY . /app/
WORKDIR /app

enter image description here

-- RahulKumarShaw-MT
Source: StackOverflow