skip to Main Content

I have a Dockerfile that looks like that:

FROM ubuntu:latest

RUN apt-get update && 
      apt-get -y install sudo
RUN apt-get update; apt-get install -y curl; apt-get install -y unzip
RUN apt-get install -y cron
RUN apt-get install -y nmap
RUN apt-get install -y mysql-client 
RUN apt-get install net-tools
RUN chmod 0644 /etc/cron.d/local-crons
RUN crontab /etc/cron.d/local-crons
RUN touch /var/log/cron.log
RUN curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"; unzip awscliv2.zip; sudo ./aws/install

ENV AWS_ACCESS_KEY_ID="xxxx"
ENV AWS_SECRET_ACCESS_KEY="xxxx"
ENV AWS_DEFAULT_REGION="xxxx"
ENV AWS_BUCKET="xxxx"

CMD cron && tail -f /var/log/cron.log

It is building well on my computer (mac os) and on another linux computer. However it fails on dockerhub with the following message:

#6 [ 2/20] RUN apt-get update && apt-get -y install sudo
#6 sha256:224dddb10ca592f897102d7f5c81b97d445e7acd4f177d35f819bbbae03d8cd5
#6 0.629 Get:1 http://security.ubuntu.com/ubuntu jammy-security InRelease [110 kB]
#6 0.630 Get:2 http://archive.ubuntu.com/ubuntu jammy InRelease [270 kB]
#6 1.038 Get:3 http://archive.ubuntu.com/ubuntu jammy-updates InRelease [109 kB]
#6 1.042 Get:4 http://security.ubuntu.com/ubuntu jammy-security/restricted amd64 Packages [61.3 kB]
#6 1.138 Get:5 http://archive.ubuntu.com/ubuntu jammy-backports InRelease [90.7 kB]
#6 1.170 Get:6 http://security.ubuntu.com/ubuntu jammy-security/main amd64 Packages [66.2 kB]
#6 1.203 Get:7 http://security.ubuntu.com/ubuntu jammy-security/universe amd64 Packages [13.7 kB]
#6 1.234 Get:8 http://archive.ubuntu.com/ubuntu jammy/main amd64 Packages [1792 kB]
#6 1.519 Get:9 http://archive.ubuntu.com/ubuntu jammy/universe amd64 Packages [17.5 MB]
#6 2.394 Get:10 http://archive.ubuntu.com/ubuntu jammy/restricted amd64 Packages [164 kB]
#6 2.403 Get:11 http://archive.ubuntu.com/ubuntu jammy/multiverse amd64 Packages [266 kB]
#6 2.405 Get:12 http://archive.ubuntu.com/ubuntu jammy-updates/universe amd64 Packages [20.3 kB]
#6 2.407 Get:13 http://archive.ubuntu.com/ubuntu jammy-updates/restricted amd64 Packages [61.3 kB]
#6 2.408 Get:14 http://archive.ubuntu.com/ubuntu jammy-updates/main amd64 Packages [72.0 kB]
#6 3.333 Fetched 20.6 MB in 3s (7199 kB/s)
#6 3.333 Reading package lists...
#6 4.477 E: Problem executing scripts APT::Update::Post-Invoke 'rm -f /var/cache/apt/archives/*.deb /var/cache/apt/archives/partial/*.deb /var/cache/apt/*.bin || true'
#6 4.477 E: Sub-process returned an error code
#6 ERROR: executor failed running [/bin/sh -c apt-get update && apt-get -y install sudo]: exit code: 100
------
> [ 2/20] RUN apt-get update && apt-get -y install sudo:
------
error: failed to solve: rpc error: code = Unknown desc = executor failed running [/bin/sh -c apt-get update && apt-get -y install sudo]: exit code: 100
Build failed using Buildkit

It is worth mentioning that it was building fine until today (I just added the environment variables AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY,…)

enter image description here

2

Answers


  1. Chosen as BEST ANSWER

    I changed the first line FROM ubuntu:latest to FROM ubuntu:18.04 and it worked !


  2. I had the same issue today it seems to be related with the latest version of the Ubuntu image.

    Try specifying an exact one

    FROM ubuntu:18.04
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search