skip to Main Content

I am trying to build an image for a django project. I tried ”’sudo docker login”’, after that also same error message. tried in macOS M1 & rasberrypi 4B.

**Dockerfile:

FROM python3.9.2-slim

ENV PYTHONUNBUFFERED 1

RUN sudo apt update -y && sudo apt upgrade -y

RUN mkdir /app
WORKDIR /app

COPY requirements.txt /app/
RUN pip install --user -r requirements.txt

COPY . /app/

CMD python3 manage.py runserver

Output(sudo docker build . -t ttapp-image):

[+] Building 2.1s (4/4) FINISHED          docker:default
 => [internal] load build definition from Dockerfi  0.0s
 => => transferring dockerfile: 279B                0.0s
 => [internal] load .dockerignore                   0.0s
 => => transferring context: 2B                     0.0s
 => ERROR [internal] load metadata for docker.io/l  2.0s
 => [auth] library/python3.9.2-slim:pull token for  0.0s
------
 > [internal] load metadata for docker.io/library/python3.9.2-slim:latest:
------
Dockerfile:1
--------------------
   1 | >>> FROM python3.9.2-slim
   2 |     
   3 |     ENV PYTHONUNBUFFERED 1
--------------------
ERROR: failed to solve: python3.9.2-slim: pull access denied, repository does not exist or may require authorization: server message: insufficient_scope: authorization failed

2

Answers


  1. Change image from python3.9.2-slim to python:3.9.2-slim.

    Login or Signup to reply.
  2. Just a couple of suggestions to your dockerfile that may help solve the problem.

    you dont have to specify the complete image name and tag..instead use

    FROM python:3.9-slim
    

    You also dont need to use sudo inside docker. Docker runs the commands as root user by default unless specified. instead use..

    RUN apt-get update && apt-get upgrade -y
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search