Search code examples
dockerdocker-build

docker build giving unauthorized: authentication required


My docker version is

Docker version 1.12.2-cs2-ws-beta, build 050b611

I am trying to build the image using command

docker build -t iis-dockerfile .

The DockerFile content is

FROM microsoft/iss
RUN echo "Hello World - Dockerfile" > C:\inetpub\wwwroot\index.html

config.json is

{
    "auths": {
        "https://index.docker.io/v1/": {
            "auth": <somekey>
        }
    }
}

On running docker build, it gives error

Sending build context to Docker daemon 2.048 kB
Step 1/2 : FROM microsoft/iss
unauthorized: authentication required

I have already done docker login. That's how config.json is created. I am new to containers and following the get started tutorial https://blogs.msdn.microsoft.com/allthingscontainer/2016/09/15/windows-containers-getting-started-a-step-by-step-guide/. Any idea how can I work around this.

Also I figured out that docker pull is working for me. While this also required authentication


Solution

  • Just an observation. Make sure your docker file has correct base image name. Are you sure you want FROM microsoft/iss and not FROM microsoft/iis?

    When I tried to create new image with correct base image. It seem to work.

    Docker docker build -t test-iid .
    Sending build context to Docker daemon 344.9 MB
    Step 1/2 : FROM microsoft/iis
    latest: Pulling from microsoft/iis
    3889bb8d808b: Downloading
    3430754e4d17: Downloading
    7aee39cd34f9: Downloading [>                                                  ]   540 kB/122.7 MB
    5b8e6b632025: Download complete
    e067d71858d2: Download complete