Building docker image failing when loading metadata - docker

Im trying to create a docker image using my Dockerfile. I have no prior experience with Docker so I cant really decribe the problem better. I was able to do this yesterday without problems, but I deleted the image and now I cant recreate it.
My Dockerfile
FROM bitnami/spark
USER root
RUN pip install unidecode
RUN curl https://repo1.maven.org/maven2/com/databricks/spark-xml_2.12/0.13.0/spark-xml_2.12-0.13.0.jar --output /opt/bitnami/spark/jars/spark-xml_2.10-0.2.0.jar
ENV PYTHONPATH=$SPARK_HOME/python:$SPARK_HOME/python/lib/py4j-0.10.9-src.zip:$PYTHONPATH
Im trying to create docker image by this command docker build -t imagename .
I am in the same directory as Dockerfile, so thats not the issue.
This is the output I get when I run the command above.
[+] Building 32.0s (3/3) FINISHED
=> [internal] load build definition from Dockerfile 0.1s
=> => transferring dockerfile: 38B 0.0s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> ERROR [internal] load metadata for docker.io/bitnami/spark:latest 31.8s
------
> [internal] load metadata for docker.io/bitnami/spark:latest:
------
failed to solve with frontend dockerfile.v0: failed to create LLB definition: failed to authorize:
rpc error: code = Unknown desc = failed to fetch anonymous token:
Get "https://auth.docker.io/token?scope=repository%3Abitnami%2Fspark%3Apull&service=registry.docker.io":
dial tcp 54.85.56.253:443: i/o timeout

Restarting docker helped me to fix this.

Reinstalling docker helped to fix this problem

Related

Docker trying to pull non-existent image from dockerhub when Image exists locally

Total docker newbie here and I would appreciate any help I could get. I pulled an image from my ECR repository and tagged it as app:latest using this command:
docker tag xxxxxxxxxxxx.dkr.ecr.us-east-2.amazonaws.com/app app:latest. When I list my imaged with docker images, the image is there with the new tag.
REPOSITORY TAG IMAGE ID CREATED SIZE
xxxxxxxxxxxx.dkr.ecr.us-east-2.amazonaws.com/app latest b5c8c2b74272 4 weeks ago 660MB
app latest b5c8c2b74272 4 weeks ago 660MB
I want to use this app:latest image as the base image in my Dockerfile. I know docker's default behavior is to check locally for the image and pull from dockerhub if it's not stored locally. When I run docker build -t hello ., I get this error:
[+] Building 1.3s (4/4) FINISHED
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 36B 0.0s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> ERROR [internal] load metadata for docker.io/library/app:latest 1.2s
=> [auth] library/app:pull token for registry-1.docker.io 0.0s
------
> [internal] load metadata for docker.io/library/app:latest:
------
failed to solve with frontend dockerfile.v0: failed to create LLB definition: pull access denied, repository does not exist or may require authorization: server message: insufficient_scope: authorization failed
Why is docker trying to pull from dockerhub when the app:latest image exists locally? Any insights would be greatly appreciated. Thank you!
I think this issue is related to me using an M1 computer. I ran these commands and I was able to successfully build my docker image from my Dockerfile
export DOCKER_BUILDKIT=0
export COMPOSE_DOCKER_CLI_BUILD=0

How to run a Cenos7 docker image on an ARM based Mac

I am tring to create a Dockerfile to run CentOS. One of the host systems needing to run this container is an ARM based (m1) Mac. These are the two files I have created so far.
# Dockerfile
FROM centos:7
# docker-compose.yml
version: "3.9"
services:
genesis:
build: .
When trying to run/build this cointainer I get the following error
Building genesis
[+] Building 0.9s (4/4) FINISHED
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 77B 0.0s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> ERROR [internal] load metadata for docker.io/library/centos:7 0.8s
=> [auth] library/centos:pull token for registry-1.docker.io 0.0s
------
> [internal] load metadata for docker.io/library/centos:7:
------
failed to solve with frontend dockerfile.v0: failed to create LLB definition: failed to authorize: rpc error: code = Unknown desc = failed to fetch oauth token: Get "https://auth.docker.io/token?scope=repository%3Alibrary%2Fcentos%3Apull&service=registry.docker.io": read tcp 192.168.1.209:64469->3.228.155.36:443: read: software caused connection abort
ERROR: Service 'genesis' failed to build : Build failed
After some google searching and answers on stack overflow it looks like the issue is something to do with the architecture difference between the containers and the host. I have tried setting the dockerfile to
FROM --platform=aarch/arm centos:7
and
FROM --platform=linux/amd64 centos:7
but neither of these work, and they're returning the same error as before. I have also tried specifying the platform in the docker-compose file too but that didn't work either.
Interestingly I did seem to have it working when I use the command in the shell
$ docker run --rm -it --platform=linux/amd64 centos:7 sh
but I need to have it working in the dockerfile as I need to then have more setup in the dockefile
Docker isn't a virtual machine, so there are some limitations.
Your application is for Linux, but you appear to be trying to run it from macOS?
Does your FROM lines specify a version of Linux?
If so, you need a build a new container of binaries native to macOS and avoid using Linux containers in your FROM lines.

How to build self-hosted devops agent in Docker locally

I have followed these steps and when I run PS C:\dockeragent> docker build -t dockeragent:latest .
I get
[+] Building 0.8s (3/3) FINISHED
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 31B 0.0s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> ERROR [internal] load metadata for mcr.microsoft.com/windows/servercore:ltsc2019 0.7s
------
> [internal] load metadata for mcr.microsoft.com/windows/servercore:ltsc2019:
------
failed to solve with frontend dockerfile.v0: failed to create LLB definition: no match for platform in manifest sha256:etcetc: not found
I am using VSC with Docker extention on my local computer. How can I build this image?
From the log, the image is build from a windows image(windows/servercore:ltsc2019).
You need to check if the docker desktop on your local machine is running on Windows containers.
If no, you need to switch it to Windows containers.

docker build with WSL2 - failed to create LLB definition: unexpected status code 403 Forbidden

Windows 10 Version: 10.0.18362.1256
Docker Desktop Version: 3.6.0(the latest until 2021/8/25)
Dockerfile from https://github.com/docker/getting-started.
Command: docker build -t getting-started .
Logs:
niaomingjian#DESKTOP-DQO:~/docker/getting-started$ docker build -t getting-started .
[+] Building 0.2s (5/5) FINISHED
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 1.05kB 0.0s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 52B 0.0s
=> CANCELED [internal] load metadata for docker.io/library/nginx:alpine 0.1s
=> CANCELED [internal] load metadata for docker.io/library/python:alpine 0.1s
=> ERROR [internal] load metadata for docker.io/library/node:12-alpine 0.1s
------
> [internal] load metadata for docker.io/library/node:12-alpine:
------
failed to solve with frontend dockerfile.v0: failed to create LLB definition: unexpected status code [manifests 12-alpine]: 403 Forbidden
Command docker pull node:12-alpine succeeded.
Pulling nginx:alpine, python:alpine, node:12-alpine respectively can work.
But the pulling process could't work in the building process.
Based Jeff Gruenbaum's comment:
Are you using gcr? 403 Forbidden means you don't have permission to pull.
Try (You must using gcloud if pull from gcr, right?):
gcloud config configurations list then you see list of your gcp account
switch your account to account that have pull permission by gcloud config configurations activate YOUR_ACCOUNT.

How to include credentials in dockerfile from clause

I am new to Docker.
I cloned the GitHub project and trying to create the image by running:
docker build -t imagename .
But its giving an error:
username#LAPTOP-MMMMBU:~/myfolder/test$ docker build -t newimage .
[+] Building 10.8s (3/3) FINISHED
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 38B 0.0s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> ERROR [internal] load metadata for registry.abcd.org/test:base 10.8s
------
> [internal] load metadata for registry.abcd.org/test:base:
------
failed to solve with frontend dockerfile.v0: failed to create LLB definition: unexpected status code [manifests base]: 401 Unauthorized
Where to insert the credentials here (user/password).
Please help.
If you are asking how you can authenticate to the docker registry where you are pulling your base image, you can run docker login registry.abcd.org, and enter your username and password when prompted. Your subsequent build command will then be able to pull the image.
docker login [OPTIONS] [SERVER]
https://docs.docker.com/engine/reference/commandline/login/

Resources