Pull access denied while using docker-compose

Facing strange issue while pulling using docker-compose, I am having free account, there are two repos in my Docker Hub. 1. jayforu/hello and jayforu/helloapi. Attached is YML, strange thing is this issue occurs for whatever image/repo which is second in turn in YML file. I am using Windows 10.

Here is YML file and the output which I am getting

version: '3.7'

services:
  web:
    build: hello
    container_name: web
    hostname: web
    image: jayforu/hello
  #  networks:
   #   backend:
         #aliases: 
          #  - web
      #   ipv4_address: 172.16.238.01
          
    ports:
      - 81:80
  webapi:
    build: HelloApi
    container_name: webapi
    hostname: webapi
    image: jayforu/helloapi
  #  networks:
   #   backend:
         #aliases: 
          #  - webapi
        #ipv4_address: 172.16.238.02
    ports:
      - 80:80

Output which I am getting afte executing different commands

C:\Github\vinayak>docker-compose build --no-cache
Building web
Step 1/10 : FROM node:latest as node
 ---> f7756628c1ee
Step 2/10 : WORKDIR /app
 ---> Running in a756ea2fd071
Removing intermediate container a756ea2fd071
 ---> 6a545b7c4404
Step 3/10 : COPY . .
 ---> 99315cf72940
Step 4/10 : RUN npm install
 ---> Running in df0a41fbae2a
npm WARN bootstrap@4.4.1 requires a peer of popper.js@^1.16.0 but none is installed. You must install peer dependencies yourself.
npm WARN karma-jasmine-html-reporter@1.5.1 requires a peer of jasmine-core@>=3.5 but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.11 (node_modules/webpack-dev-server/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.11: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.11 (node_modules/watchpack/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.11: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.11 (node_modules/karma/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.11: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.11 (node_modules/@angular/compiler-cli/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.11: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.1.2 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.1.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

audited 18884 packages in 6.637s

24 packages are looking for funding
  run `npm fund` for details

found 2 high severity vulnerabilities
  run `npm audit fix` to fix them, or `npm audit` for details
Removing intermediate container df0a41fbae2a
 ---> 46a1f7736c07
Step 5/10 : RUN npm run build
 ---> Running in c46d2a67306b

> hello@0.0.0 build /app
> ng build --prod

Generating ES5 bundles for differential loading...
ES5 bundle generation complete.

chunk {2} polyfills-es2015.2987770fde9daa1d8a2e.js (polyfills) 36.4 kB [initial] [rendered]
chunk {3} polyfills-es5.6696c533341b95a3d617.js (polyfills-es5) 123 kB [initial] [rendered]
chunk {0} runtime-es2015.edb2fcf2778e7bf1d426.js (runtime) 1.45 kB [entry] [rendered]
chunk {0} runtime-es5.edb2fcf2778e7bf1d426.js (runtime) 1.45 kB [entry] [rendered]
chunk {1} main-es2015.ba4968565935227faa15.js (main) 227 kB [initial] [rendered]
chunk {1} main-es5.ba4968565935227faa15.js (main) 280 kB [initial] [rendered]
chunk {4} styles.3ff695c00d717f2d2a11.css (styles) 0 bytes [initial] [rendered]
Date: 2020-01-17T08:29:46.981Z - Hash: b5293c52f2738f2cf4a2 - Time: 26887ms
Removing intermediate container c46d2a67306b
 ---> 7a04a9221124

Step 6/10 : FROM nginx:alpine
 ---> 36189e6707f4
Step 7/10 : COPY --from=node /app/dist/hello /usr/share/nginx/html
 ---> 4cc147c18f67
Step 8/10 : COPY --from=node /app/nginx-custom.conf /etc/nginx/conf.d/default.conf
 ---> 9fb0b9f97239
Step 9/10 : EXPOSE 80
 ---> Running in 292e4721e865
Removing intermediate container 292e4721e865
 ---> 1c6fbd744568
Step 10/10 : CMD ["nginx", "-g", "daemon off;"]
 ---> Running in 459e89a78ebc
Removing intermediate container 459e89a78ebc
 ---> d52f7f23329f

Successfully built d52f7f23329f
Successfully tagged jayforu/hello:latest
Building webapi
Step 1/17 : FROM microsoft/dotnet:2.2-aspnetcore-runtime-alpine AS base
 ---> 0e59b34ad3cb
Step 2/17 : WORKDIR /app
 ---> Running in c624eec3fc2b
Removing intermediate container c624eec3fc2b
 ---> 21d5b983ce87
Step 3/17 : EXPOSE 80
 ---> Running in fa8dc1dd21ec
Removing intermediate container fa8dc1dd21ec
 ---> 99acf3145ace
Step 4/17 : EXPOSE 443
 ---> Running in f0c03efa1ddb
Removing intermediate container f0c03efa1ddb
 ---> d0ed96c7f5d9

Step 5/17 : FROM microsoft/dotnet:2.2-sdk-alpine AS build
 ---> 6ab73e836ec1
Step 6/17 : WORKDIR /src
 ---> Running in 263f62818e48
Removing intermediate container 263f62818e48
 ---> bf5f03f7dc1d
Step 7/17 : COPY ["HelloApi/HelloApi.csproj", "HelloApi/"]
 ---> bb188ee75116
Step 8/17 : RUN dotnet restore "HelloApi/HelloApi.csproj"
 ---> Running in 5410fd88f0ae
  Restore completed in 7.33 sec for /src/HelloApi/HelloApi.csproj.
Removing intermediate container 5410fd88f0ae
 ---> 53ed23d0bab8
Step 9/17 : COPY . .
 ---> 25c6ef56613e
Step 10/17 : WORKDIR "/src/HelloApi"
 ---> Running in 2a9a22d24e92
Removing intermediate container 2a9a22d24e92
 ---> 59eba9993447
Step 11/17 : RUN dotnet build "HelloApi.csproj" -c Release -o /app
 ---> Running in 390a8f99d3d1
Microsoft (R) Build Engine version 16.0.450+ga8dc7f1d34 for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.

  Restore completed in 52.82 ms for /src/HelloApi/HelloApi.csproj.
  HelloApi -> /app/HelloApi.dll

Build succeeded.
    0 Warning(s)
    0 Error(s)

Time Elapsed 00:00:02.38
Removing intermediate container 390a8f99d3d1
 ---> 5b98109ee6e4

Step 12/17 : FROM build AS publish
 ---> 5b98109ee6e4
Step 13/17 : RUN dotnet publish "HelloApi.csproj" -c Release -o /app
 ---> Running in 7fe4b66b7b4d
Microsoft (R) Build Engine version 16.0.450+ga8dc7f1d34 for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.

  Restore completed in 43.06 ms for /src/HelloApi/HelloApi.csproj.
  HelloApi -> /src/HelloApi/bin/Release/netcoreapp2.1/HelloApi.dll
  HelloApi -> /app/
Removing intermediate container 7fe4b66b7b4d
 ---> e84617d31f64

Step 14/17 : FROM base AS final
 ---> d0ed96c7f5d9
Step 15/17 : WORKDIR /app
 ---> Running in 6f2aa2589231
Removing intermediate container 6f2aa2589231
 ---> a77bc17b7a64
Step 16/17 : COPY --from=publish /app .
 ---> 15e763021983
Step 17/17 : ENTRYPOINT ["dotnet", "HelloApi.dll"]
 ---> Running in af30701d87e5
Removing intermediate container af30701d87e5
 ---> 1f572398e65e

Successfully built 1f572398e65e
Successfully tagged jayforu/helloapi:latest
#########
C:\Github\vinayak>docker-compose push
Pushing web (jayforu/hello:latest)...
The push refers to repository [docker.io/jayforu/hello]
05afd4ef8748: Pushed
406e2aae0fd7: Pushed
671c8a3d8285: Pushed
77cae8ab23bf: Pushed
latest: digest: sha256:404f2fdba73054a4e6e14d958dea1c2b14018f5d9b7d22bd876d836d7b6c035c size: 1156
Pushing webapi (jayforu/helloapi:latest)...
The push refers to repository [docker.io/jayforu/helloapi]
e6c0912ca1f1: Pushed
6f2166ea3b3f: Pushed
2a3342f0b3a5: Pushed
cabb36589317: Pushed
77cae8ab23bf: Mounted from jayforu/hello
latest: digest: sha256:416196c360e117a8bea023e21bd7717b613c7e9e53aeb9bed72eb241ba1f7c5b size: 1366
############################################################
C:\Github\vinayak>docker-compose pull
Pulling web    ... done
Pulling webapi ... error

**ERROR: for webapi  pull access denied for jayforu/helloapi, repository does not exist or may require 'docker login': denied: requested access to the resource is denied**
**ERROR: pull access denied for jayforu/helloapi, repository does not exist or may require 'docker login': denied: requested access to the resource is denied**

You have an operation ( "pull ) and an error message. If the error message does not provide helpful information or it is not clear, try a quick search in the knowledge base. I found this::

dockerfile - denied: requested access to the resource is denied: docker - Stack Overflow

Try running docker login first before pulling. Or even better, only try pulling and running just the container with docker run. This should solve your issue.

Kf

Well, not a very helpful answer. You don’t know the whole context. Maybe someone uses multistage build (as I do), does not push any images anywhere, just wants to copy over files from one stage to the other, uses docker compose for users so the mounting points are explicitly defined in config files and users do not need to worry about enabling ports mounting folders or whatever. Also, you might extend your system with multiple images in the future. So you run your single multistage container with compose and what you get is this stupid error.

1 Like