When running docker file this line failed
RUN apt-get update && apt-get install -y wget && apt-get install -y gnupg2 && wget -qO- https://deb.nodesource.com/setup_14.x | bash - && apt-get install -y build-essential nodejs
failed to solve with frontend dockerfile.v0: failed to build LLB: failed to load cache key: pull access denied, repository does not exist or may require authorization: server message: insufficient_scope: authorization failed
I just had the issue, and in my case, the problem was with multistage build: I forgot to include as <stage_name> in my first stage in Dockerfile.
So as the first line I had
FROM maven:3.6.3-jdk-11-slim#latest
But I should have
FROM maven:3.6.3-jdk-11-slim#latest as build
instead, since I was referencing build in the next stage.
I had this issue too. In my case, was named image out of format.
It is wrong:
FROM debian:latest as imageBaseFromAnyThing
...
FROM imageBaseFromAnyThing as imageBaseFromAnyThingApp
...
or this
FROM debian:latest as image-base-from-any-thing
...
FROM image-base-from-any-thing as image-base-from-any-thing-app
...
Try keep simple, like:
FROM debian:latest as image
...
FROM image as app
Related
My dockerfile used to build successfully.
I tried to build today (5 days after successful build) with docker build -t fv ., and kept getting the following error:
failed commit on ref "layer-sha256:7a3de07a56633b9096304d02c47f097f3e28ae6c6dd442d1e7c4d26452ecd90a": "layer-sha256:7a3de07a56633b9096304d02c47f097f3e28ae6c6dd442d1e7c4d26452ecd90a" failed size validation: 581433721 != 600361569: failed precondition
any suggestions what this means and how to correct?
my dockerfile is:
FROM rocker/verse
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install -y --no-install-recommends build-essential libpq-dev python3.8 python3-pip python3-setuptools python3-dev
RUN pip3 install --upgrade pip
ADD . ./home/rstudio
ADD requirements.txt .
ADD install_packages.r .
# Miniconda and dependencies
RUN cd /tmp/ && \
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh && \
bash Miniconda3-latest-Linux-x86_64.sh -b -p $HOME/miniconda3 && \
/root/miniconda3/condabin/conda install -y python=3.7
ENV PATH=$PATH:/root/miniconda3/bin
#RUN npm install phantomjs-prebuilt --phantomjs_cdnurl=http://cnpmjs.org/downloads
# installing python libraries
RUN pip3 install -r requirements.txt
# installing r libraries
RUN Rscript install_packages.r
another reference I got was:
=> => sha256:7a3de07a56633b9096304d02c47f097f3e28ae6c6dd442d1e7c4d26452ecd90a 580.97MB / 600.36MB 1150.8s
------
> [ 1/10] FROM docker.io/rocker/verse#sha256:3b417b991a32cc8bf9c1fa173ec976a5cc65522a76918df61b5c6cf6261e63a5:
Would this be because of an issue with the base image pulled?
I found that docker build would fail with this error, but it would work if I first pulled the failing image with docker pull <image> and then ran docker build.
this was due to security encryption from my local ip.
when tethering, was able to generate the docker image with non problems
On my side, I got something like below
------
> [1/3] FROM docker.io/library/python#sha256:10fc14aa6ae69f69e4c953cffd9b0964843d8c163950491d2138af891377bc1d:
------
failed commit on ref "layer-sha256:049db2c7eb8a5bd3833cac2f58c6c72b481f1a0288a8b20527529c4970b52762": "layer-sha256:049db2c7eb8a5bd3833cac2f58c6c72b481f1a0288a8b20527529c4970b52762" failed size validation: 311296 != 3056504: failed precondition
On my side, I managed to solve this by disconnecting from a VPN I was connected to.
I'm trying to install a simple linux environment with opam on docker:
$ type .\Dockerfile_Opam.txt
FROM ubuntu:22.04
RUN \
apt-get update -y && \
apt-get install opam -y && \
opam init
Equivalent commands work fine on native linux but with docker I get an error:
$ docker build --tag host --file .\Dockerfile_Opam.txt .
# ... omitted for brevity ...
#5 48.09 [ERROR] Sandboxing is not working on your platform ubuntu:
#5 48.09 "~/.opam/opam-init/hooks/sandbox.sh build sh -c echo SUCCESS >$TMPDIR/opam-sandbox-check-out && cat $TMPDIR/opam-sandbox-check-out; rm -f $TMPDIR/opam-sandbox-check-out" exited with code 1 "bwrap: Creating new namespace failed: Operation not permitted"
OPAM runs builds when installing packages. To guard against buggy makefiles (that might run rm -rf / by accident), OPAM uses bubblewrap to sandbox the builds. Either install bubblewrap (apt-get install bubblewrap) or, if you wish to skip, because you're running in a container anyway, initialize OPAM like this:
opam init --disable-sandboxing
This also works but idk if its safe or the cons/pros with the disabling sandbox option:
USER root
RUN apt-get update && apt-get install -y --no-install-recommends bubblewrap
RUN opam init
I have a dockerfile to upload some python code on Azure. It has been working for a few months, but today it suddenly stopped working.
The relevant commands in the Dockerfile are:
FROM python:3.9.5
:
:
RUN curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add -
RUN curl https://packages.microsoft.com/config/ubuntu/20.04/prod.list > /etc/apt/sources.list.d/mssql-release.list
RUN exit
RUN apt-get update && ACCEPT_EULA=Y apt-get install msodbcsql17
The error message is that appeared today is:
Err:1 https://packages.microsoft.com/ubuntu/20.04/prod focal/main amd64 msodbcsql17 amd64 17.7.2.1-1
404 Not Found [IP: 104.214.230.139 443]
E: Failed to fetch https://packages.microsoft.com/ubuntu/20.04/prod/pool/main/m/msodbcsql17/msodbcsql17_17.7.2.1-1_amd64.deb 404 Not Found [IP: 104.214.230.139 443]
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?
The command '/bin/sh -c apt-get update && ACCEPT_EULA=Y apt-get install msodbcsql17' returned a non-zero code: 100
2021/06/16 20:50:56 Container failed during run: build. No retries remaining.
failed to run step ID: build: exit status 100
I believe this might be related to the .deb files being moved - or that some computer at Microsoft is down?
A good workaround would maybe be to download the relevant msodbcsql17 package directly, but I was unable to find this package in the normal repos?
There seems to be some ongoing trouble with microsoft repos for some linux distributions (including ubuntu and debian). Not clear when this will be fixed.
https://github.com/dotnet/core/issues/6381
https://github.com/MicrosoftDocs/sql-docs/issues/6494
The answer might be related to this post:
https://github.com/dotnet/core/issues/6381
It seems that some Ubuntu repositories are broken.
Hopefully it will be fixed soon...
I Will keep an eye on the resolve, but I have the same issue using:
FROM python:3
ENV PYTHONUNBUFFERED 1
RUN mkdir /code
WORKDIR /code
RUN curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add -
RUN curl https://packages.microsoft.com/config/ubuntu/16.04/prod.list > /etc/apt/sources.list.d/mssql-release.list
RUN apt-get update
RUN ACCEPT_EULA=Y apt-get install -y msodbcsql17
# optional: for bcp and sqlcmd
RUN ACCEPT_EULA=Y apt-get install -y mssql-tools
RUN echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bash_profile
RUN echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bashrc
# optional: for unixODBC development headers
RUN apt-get install -y unixodbc-dev
I am trying to dockerfy the installation guide described here:
https://docs.opsmanager.mongodb.com/current/tutorial/install-simple-test-deployment/
I have created this minimal dockerfile:
FROM registry.access.redhat.com/rhel7/rhel:latest
RUN yum install -y mongodb-org mongodb-org-shell
But when I build it I get:
$ docker build . -t my-image
Sending build context to Docker daemon 22.53kB
Step 1/2 : FROM x.y.z:1234/rhel7/rhel:latest
---> 6979ec30598b
Step 2/2 : RUN yum install -y mongodb-org mongodb-org-shell
---> Running in d696383b761d
Loaded plugins: ovl, product-id, search-disabled-repos, subscription-manager
This system is not registered with an entitlement server. You can use subscription-manager to register.
There are no enabled repos.
Run "yum repolist all" to see the repos you have.
To enable Red Hat Subscription Management repositories:
subscription-manager repos --enable <repo>
To enable custom repositories:
yum-config-manager --enable <repo>
From the above guide I need to first add:
echo "[mongodb-org-4.0]
name=MongoDB Repository
baseurl=https://repo.mongodb.org/yum/redhat/7/mongodb-org/4.0/x86_64/
gpgcheck=1
enabled=1
gpgkey=https://www.mongodb.org/static/pgp/server-4.0.asc" | sudo tee /etc/yum.repos.d/mongodb.repo
this to my dockerfile. Any input/examples on how to do that? I guess I basically need to copy the above text block into a /etc/yum.repos.d/mongodb.repo file on the image?
Edit: Based on below answer I can now docker ADD the repo file into the image and the above error is fixed. But I get this instead:
--> Processing Dependency: openssl for package: mongodb-org-tools-4.0.9-1.el7.x86_64
--> Finished Dependency Resolution
Error: Package: mongodb-org-tools-4.0.9-1.el7.x86_64 (mongodb-org-4.0)
Requires: openssl
Error: Package: mongodb-org-server-4.0.9-1.el7.x86_64 (mongodb-org-4.0)
Requires: openssl
Error: Package: mongodb-org-shell-4.0.9-1.el7.x86_64 (mongodb-org-4.0)
Requires: openssl
You could try using --skip-broken to work around the problem
You could try running: rpm -Va --nofiles --nodigest
The command '/bin/sh -c yum install -y mongodb-org mongodb-org-shell' returned a non-zero code: 1
Not sure if that is related to the repo information. I also tried to install openssl in dockerfile with:
RUN yum install openssl
but that gives:
No package openssl available.
Error: Nothing to do
The command '/bin/sh -c yum install openssl' returned a non-zero code: 1
Create a file in the same folder of your Dockerfile with the contents and add them to the image. Example:
cat <<EOF > mongodb.repo
[mongodb-org-4.0]
name=MongoDB Repository
baseurl=https://repo.mongodb.org/yum/redhat/7/mongodb-org/4.0/x86_64/
gpgcheck=1
enabled=1
gpgkey=https://www.mongodb.org/static/pgp/server-4.0.asc
EOF
Then in your Dockerfile:
FROM registry.access.redhat.com/rhel7/rhel:latest
ADD mongodb.repo /etc/yum.repos.d/mongodb.repo
RUN yum update && \
yum install -y mongodb-org mongodb-org-shell
I have a Dockerfile that works, but if I add any new dependencies to the apt-get install command, it fails. For example, this works:
FROM debian:stable
RUN apt-get update
RUN apt-get install -y \
python \
...
apache2
But if I try this, it fails:
FROM debian:stable
RUN apt-get update
RUN apt-get install -y \
python \
...
apache2
python-mysqldb
I can replace python-mysqldb with anything else, git-core, for example, and it will still fail with the same error message:
Unable to correct missing packages.
E: Failed to fetch http://security.debian.org/pool/updates/main/l/linux/linux-libc-dev_3.16.7-ckt11-1+deb8u5_amd64.deb 404 Not Found [IP: 149.20.20.6 80]
E: Aborting install.
Any thoughts on why adding a new dependency causes the failure and how to fix it?
I've found that you need to join the update & install command into the same RUN block.
eg:
RUN apt-get update \
&& apt-get install -y \
python \
...
apache2 \
python-mysqldb
According to this post describing the issue
By default, Docker cache your commands to reduce time spent building
images. Unless there was any change before such commands (or at the
same line).
Meanwhile, I notice that the AWS examples separate them, as you have them. So I dunno if it works different there. Maybe they disable the cache by default.