how to update apt-key list in docker - docker

I have a Dockerfile
FROM mariadb:10.1.21
COPY mariadb.cnf /etc/mysql/conf.d
RUN apt-get update \
&& apt-get install --assume-yes mariadb-backup-10.1 \
&& rm -rf /var/lib/apt/lists/*
when I'm running docker build . the apt-get update command throws errors:
Get:8 https://repo.percona.com jessie/main amd64 Packages [22.1 kB]
Get:9 http://deb.debian.org jessie/main amd64 Packages [9098 kB]
W: GPG error: http://security.debian.org jessie/updates InRelease: The following signatures were invalid: KEYEXPIRED 1668892417 The following signatures couldn't be verified because the public key is not available: NO_PUBKEY AA8E81B4331F7F50
W: GPG error: http://deb.debian.org jessie-updates InRelease: The following signatures were invalid: KEYEXPIRED 1668891673
W: GPG error: http://deb.debian.org jessie Release: The following signatures were invalid: KEYEXPIRED 1668891673
W: Failed to fetch http://ftp.osuosl.org/pub/mariadb/repo/10.1/debian/dists/jessie/main/binary-amd64/Packages 404 Not Found [IP: 64.50.236.52 80]
E: Some index files failed to download. They have been ignored, or old ones used instead.
I know how to update the key-list following this tutorial on my local machine. But how do I update the keys for the Dockerfile? I ran apt-key list inside the docker container and got a bunch of expired keys. Or do I just update the mariadb image version at the top?

Related

Is there any way to build the AzureDevops Buildagent image in offline?

I was following the Microsoft [Doc-][1] to run the ADO build agent in Azure Container registry.
When I tried to build the Docker image by the docker file, getting lot of network related issues.
FROM ubuntu:18.04
# To make it easier for build and release pipelines to run apt-get,
# configure apt to not require confirmation (assume the -y argument by default)
ENV DEBIAN_FRONTEND=noninteractive
RUN echo "APT::Get::Assume-Yes \"true\";" > /etc/apt/apt.conf.d/90assumeyes
RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates \
curl \
jq \
git \
iputils-ping \
libcurl4 \
libicu60 \
libunwind8 \
netcat \
libssl1.0 \
&& rm -rf /var/lib/apt/lists/*
RUN curl -LsS https://aka.ms/InstallAzureCLIDeb | bash \
&& rm -rf /var/lib/apt/lists/*
# Can be 'linux-x64', 'linux-arm64', 'linux-arm', 'rhel.6-x64'.
ENV TARGETARCH=linux-x64
WORKDIR /azp
COPY ./start.sh .
RUN chmod +x start.sh
ENTRYPOINT ["./start.sh"]
So I could see there are apt-get update and install commands which are trying for the internet connectivity and getting failed.
---> Running in 456779f71a59
Err:1 http://security.ubuntu.com/ubuntu bionic-security InRelease
Connection failed [IP: 91.189.91.38 80]
Err:2 http://archive.ubuntu.com/ubuntu bionic InRelease
Connection failed [IP: 91.189.91.39 80]
Err:3 http://archive.ubuntu.com/ubuntu bionic-updates InRelease
Connection failed [IP: 91.189.91.38 80]
Err:4 http://archive.ubuntu.com/ubuntu bionic-backports InRelease
Connection failed [IP: 91.189.91.39 80]
Reading package lists...
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/bionic/InRelease Connection failed [IP: 91.189.91.39 80]
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/bionic-updates/InRelease Connection failed [IP: 91.189.91.38 80]
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/bionic-backports/InRelease Connection failed [IP: 91.189.91.39 80]
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/bionic-security/InRelease Connection failed [IP: 91.189.91.38 80]
W: Some index files failed to download. They have been ignored, or old ones used instead.
Reading package lists...
Building dependency tree...
Reading state information...
Package ca-certificates is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
E: Package 'ca-certificates' has no installation candidate
E: Unable to locate package curl
E: Unable to locate package jq
E: Unable to locate package git
E: Unable to locate package iputils-ping
E: Unable to locate package libcurl4
E: Unable to locate package libicu60
E: Unable to locate package libunwind8
E: Unable to locate package netcat
E: Unable to locate package libssl1.0
E: Couldn't find any package by glob 'libssl1.0'
E: Couldn't find any package by regex 'libssl1.0'
So looking for a way to create image in offline and will ned to have below list of softwares coupled in it.
Azure CLI
Git 2.30.1
Python2
Python3
OpenJDK 11
OpenJDK 1.8.0
Docker 19.03.13
Helm 3.5.2
Kubectl
NodeJS 10
Maven 3.6.3
jq 1.6
Azure CLI DevOps extension
Configuration for Maven and NPM needs to be done manually.
MAVEN: "~/.m2/settings.xml"
is there any way to do this or Any Microsoft official image available in dockerhub for the selfhosted agent ?

"Unable to locate package git" when running GitLab CI/CD pipeline

I am trying to set up a GitLab CI/CD pipeline with this following .gitlab-ci.yml file:
stages:
- test
image: "ros:foxy-ros-base-focal"
before_script:
- apt-get -y update && apt-get install -y \
git wget qt5-default \
python3-osrf-pycommon \
python3-catkin-tools \
python3-rosdep \
python3-vcstool \
python3-pip \
python3-colcon-common-extensions \
apt-utils
- rm -rf /var/lib/apt/lists/*
- /bin/bash -c "source /opt/ros/${ROS_DISTRO}/setup.bash; colcon build"
- echo "source /root/dev_ws/install/setup.bash" >> /opt/ros/${ROS_DISTRO}/setup.bash
test_a:
stage: test
script:
- pip3 install pytest
- python -m pytest test_utils.py -vv -s
I am starting from the ROS2 Foxy Base Focal Docker image. However, despite running apt-get update, I still can't find many of the packages, including git as well as several other ROS2 packages. Full log here:
Running with gitlab-runner 13.8.0 (775dd39d)
on docker-auto-scale fa6cab46
Preparing the "docker+machine" executor
00:27
Using Docker executor with image ros:foxy-ros-base-focal ...
Pulling docker image ros:foxy-ros-base-focal ...
Using docker image sha256:59cf2af10ce4181bf4effbc683375f5e201bfe072c808c75fb3ee903b98265b9 for ros:foxy-ros-base-focal with digest ros#sha256:4f924ff4fdee6b7c999ad6bc013741bdf8430466c7a27842ac6255255ce9ae66 ...
Preparing environment
00:02
Running on runner-fa6cab46-project-23977848-concurrent-0 via runner-fa6cab46-srm-1611897044-53c1946d...
Getting source from Git repository
00:02
$ eval "$CI_PRE_CLONE_SCRIPT"
Fetching changes with git depth set to 50...
Initialized empty Git repository in /builds/imda_dsl/vama-2/scene-understanding/scene-understanding-manager/.git/
Created fresh repository.
Checking out fc385931 as dev...
Skipping Git submodules setup
Executing "step_script" stage of the job script
00:05
$ apt-get -y update && apt-get install -y \ git wget qt5-default \ python3-osrf-pycommon \ python3-catkin-tools \ python3-rosdep \ python3-vcstool \ python3-pip \ python3-colcon-common-extensions \ apt-utils
Get:1 http://packages.ros.org/ros2/ubuntu focal InRelease [4670 B]
Get:2 http://archive.ubuntu.com/ubuntu focal InRelease [265 kB]
Get:3 http://security.ubuntu.com/ubuntu focal-security InRelease [109 kB]
Get:4 http://packages.ros.org/ros2/ubuntu focal/main amd64 Packages [451 kB]
Get:5 http://archive.ubuntu.com/ubuntu focal-updates InRelease [114 kB]
Get:6 http://security.ubuntu.com/ubuntu focal-security/restricted amd64 Packages [161 kB]
Get:7 http://archive.ubuntu.com/ubuntu focal-backports InRelease [101 kB]
Get:8 http://archive.ubuntu.com/ubuntu focal/multiverse amd64 Packages [177 kB]
Get:9 http://archive.ubuntu.com/ubuntu focal/universe amd64 Packages [11.3 MB]
Get:10 http://security.ubuntu.com/ubuntu focal-security/main amd64 Packages [598 kB]
Get:11 http://security.ubuntu.com/ubuntu focal-security/universe amd64 Packages [659 kB]
Get:12 http://security.ubuntu.com/ubuntu focal-security/multiverse amd64 Packages [13.3 kB]
Get:13 http://archive.ubuntu.com/ubuntu focal/main amd64 Packages [1275 kB]
Get:14 http://archive.ubuntu.com/ubuntu focal/restricted amd64 Packages [33.4 kB]
Get:15 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 Packages [1003 kB]
Get:16 http://archive.ubuntu.com/ubuntu focal-updates/multiverse amd64 Packages [21.1 kB]
Get:17 http://archive.ubuntu.com/ubuntu focal-updates/restricted amd64 Packages [194 kB]
Get:18 http://archive.ubuntu.com/ubuntu focal-updates/universe amd64 Packages [920 kB]
Get:19 http://archive.ubuntu.com/ubuntu focal-backports/universe amd64 Packages [4301 B]
Fetched 17.4 MB in 2s (7001 kB/s)
Reading package lists...
Reading package lists...
Building dependency tree...
Reading state information...
E: Unable to locate package git
E: Unable to locate package python3-osrf-pycommon
E: Unable to locate package python3-catkin-tools
E: Unable to locate package python3-rosdep
E: Unable to locate package python3-vcstool
E: Unable to locate package python3-pip
E: Unable to locate package python3-colcon-common-extensions
E: Unable to locate package apt-utils
Cleaning up file based variables
00:01
ERROR: Job failed: exit code 1
Installing packages or even running update commands in your .gitlab-ci.yml is generally against best practices for a CI/CD container because each and every job that runs will have to do the same thing, costing a lot of time as you run more pipelines. If you can't find an existing Docker image that has the packages you need (so as an example, python3 and git), you can create your own images. If you need to extend the image from your job, ros:foxy-ros-base-focal, create a Dockerfile file with the following contents:
FROM ros:foxy-ros-base-focal
MAINTAINER your name "your email"
RUN apt-get update -yqq
RUN apt-get install -yqq git
You can install/configure whatever else you need to do in there too, then when you're done build the image:
docker build /path/to/dir-with-dockerfile -t tagname:version
Once the build is done you can verify the tag is correct with docker images, then you can push it to a registry (docker hub, gitlab's registry if enabled, private registry, etc) with:
docker login my.hub.example.com
docker push my.hub.example.com/tagname:version
Then in your .gitlab-ci.yml file, you can use the tagname:version image in your jobs:
stages:
- test
image: "tagname:version"
...
If you have to auth to use your registry, you'll have to review the docs here https://docs.gitlab.com/ee/ci/docker/using_docker_images.html#define-an-image-from-a-private-container-registry, and the general docs for using docker images in your pipelines is here: https://docs.gitlab.com/ee/ci/docker/using_docker_images.html

apt and apt-get in Dockerfile returning error

I am trying to create a Docker image of Cassandra. Cassandra requires Java. I have added line to install java. In my Docker file
FROM ubuntu:20.04
RUN apt-get update
RUN apt-get install default-jre
COPY apache-cassandra-3.11.6-bin.tar.gz .
RUN tar -xzf apache-cassandra-3.11.6-bin.tar.gz
RUN chmod -R 777 apache-cassandra-3.11.6
RUN ls
RUN echo $PATH
RUN echo $PWD
RUN apt update
#RUN apt-get install openjdk-7-jdk
#RUN java -version
WORKDIR apache-cassandra-3.11.6
RUN ls
ENV CASSANDRA_HOME=/apache-cassandra-3.11.6
ENV PATH=$PATH:$CASSANDRA_HOME/bin
RUN echo $PATH
RUN ls
WORKDIR apache-cassandra-3.11.6/bin
RUN ls
CMD ["cassandra","-f"]
I am getting error in apt-get update and apt. How can I fix this?
C:\Users\manuc\Documents\manu\cassandra_image_test>docker build -f CassandraImageDockerFile.txt -t manucassandra .
Sending build context to Docker daemon 184.8MB
Step 1/19 : FROM ubuntu:20.04
---> 74435f89ab78
Step 2/19 : RUN apt-get update
---> Running in b395852c8e6b
Get:1 http://archive.ubuntu.com/ubuntu focal InRelease [265 kB]
Get:2 http://security.ubuntu.com/ubuntu focal-security InRelease [107 kB]
Get:3 http://archive.ubuntu.com/ubuntu focal-updates InRelease [107 kB]
Get:4 http://archive.ubuntu.com/ubuntu focal-backports InRelease [98.3 kB]
Get:5 http://archive.ubuntu.com/ubuntu focal/restricted amd64 Packages [33.4 kB]
Get:6 http://archive.ubuntu.com/ubuntu focal/multiverse amd64 Packages [177 kB]
Get:7 http://archive.ubuntu.com/ubuntu focal/universe amd64 Packages [11.3 MB]
Get:8 http://archive.ubuntu.com/ubuntu focal/main amd64 Packages [1275 kB]
Reading package lists...
E: Release file for http://archive.ubuntu.com/ubuntu/dists/focal-updates/InRelease is not valid yet (invalid for another 1d 13h 27min 45s). Updates for this repository will not be applied.
E: Release file for http://security.ubuntu.com/ubuntu/dists/focal-security/InRelease is not valid yet (invalid for another 1d 12h 39min 24s). Updates for this repository will not be applied.
E: Release file for http://archive.ubuntu.com/ubuntu/dists/focal-backports/InRelease is not valid yet (invalid for another 1d 12h 39min 54s). Updates for this repository will not be applied.
The command '/bin/sh -c apt-get update' returned a non-zero code: 100
This seems to be an issue with your timezone. Please restart your Docker host.
Docker Desktop:
You can manually restart it using UI.
Docker machine:
$ docker-machine restart <DOCKER-MACHINE-NAME>
Podman:
$ podman restart <PODMAN-MACHINE-NAME>

A docker image based on "php:5.6.32-apache" fails to build when running "RUN apt-get update -y"

I want to build a docker image based on php:5.6.32-apache.
The content involved in this within my Dockerfile is:
FROM php:5.6.32-apache
....
RUN apt-get update -y
The console output from the built process is:
Step 6/10 : RUN apt-get update -y
---> Running in 8781a7a005ad
Get:1 http://security.debian.org jessie/updates InRelease [44.9 kB]
Ign http://deb.debian.org jessie InRelease
Get:2 http://deb.debian.org jessie-updates InRelease [7340 B]
Get:3 http://deb.debian.org jessie Release.gpg [2420 B]
Get:4 http://deb.debian.org jessie Release [148 kB]
Get:5 http://security.debian.org jessie/updates/main amd64 Packages [846 kB]
Get:6 http://deb.debian.org jessie/main amd64 Packages [9098 kB]
W: Failed to fetch http://deb.debian.org/debian/dists/jessie-updates/InRelease Unable to find expected entry 'main/binary-amd64/Packages' in Release file (Wrong sources.list entry or malformed file)
E: Some index files failed to download. They have been ignored, or old ones used instead.
Fetched 10.1 MB in 17s (565 kB/s)
ERROR: Service 'php' failed to build: The command '/bin/sh -c apt-get update -y' returned a non-zero code: 100
You can find the original php:5.6.32-apache Dockerfile here:
https://github.com/docker-library/php/blob/ec6b6e60b42c283d48775596f722f5250c1f5ca5/5.6/jessie/apache/Dockerfile
Duplicate. Please find solution at:
Build Error. Failed to fetch Build Error. Failed to fetch http://deb.debian.org/debian/dists/jessie-updates/main/binary-amd64/Packages

docker-compose returning non-zero code: 100

I am trying to use docker but am getting this error when I am trying to run docker-compose build I am getting this error. Is this a DNS issue? I tried setting
Output of sudo docker-compose build:
Building php
Step 1 : FROM pvlltvk/ubuntu-trusty-php-fpm-5.6
---> d48912228ec2
Step 2 : RUN apt-get install -y php5-curl php5-sybase freetds-dev libxml2-dev
---> Running in 0c614dc10ae3
Reading package lists...
Building dependency tree...
Reading state information...
The following extra packages will be installed:
ca-certificates freetds-common libct4 libcurl3 libidn11 librtmp0 libsybdb5
openssl
Suggested packages:
pkg-config
The following NEW packages will be installed:
ca-certificates freetds-common freetds-dev libct4 libcurl3 libidn11 librtmp0
libsybdb5 libxml2-dev openssl php5-curl php5-sybase
0 upgraded, 12 newly installed, 0 to remove and 3 not upgraded.
Need to get 2752 kB of archives.
After this operation, 8659 kB of additional disk space will be used.
Err http://ppa.launchpad.net/ondrej/php5-5.6/ubuntu/ trusty/main openssl amd64 1.0.2h-1+deb.sury.org~trusty+1
404 Not Found
Get:1 http://archive.ubuntu.com/ubuntu/ trusty/main libidn11 amd64 1.28-1ubuntu2 [93.0 kB]
Err http://ppa.launchpad.net/ondrej/php5-5.6/ubuntu/ trusty/main php5-curl amd64 5.6.23+dfsg-1+deprecated+dontuse+deb.sury.org~trusty+1
404 Not Found
Err http://ppa.launchpad.net/ondrej/php5-5.6/ubuntu/ trusty/main php5-sybase amd64 5.6.23+dfsg-1+deprecated+dontuse+deb.sury.org~trusty+1
404 Not Found
Get:2 http://archive.ubuntu.com/ubuntu/ trusty/main librtmp0 amd64 2.4+20121230.gitdf6c518-1 [57.5 kB]
Get:3 http://archive.ubuntu.com/ubuntu/ trusty/main freetds-common all 0.91-5 [24.3 kB]
Get:4 http://archive.ubuntu.com/ubuntu/ trusty/main libct4 amd64 0.91-5 [166 kB]
Get:5 http://archive.ubuntu.com/ubuntu/ trusty/main libcurl3 amd64 7.35.0-1ubuntu2 [172 kB]
Get:6 http://archive.ubuntu.com/ubuntu/ trusty/main libsybdb5 amd64 0.91-5 [194 kB]
Get:7 http://archive.ubuntu.com/ubuntu/ trusty/main ca-certificates all 20130906ubuntu2 [175 kB]
Get:8 http://archive.ubuntu.com/ubuntu/ trusty/main freetds-dev amd64 0.91-5 [514 kB]
Get:9 http://archive.ubuntu.com/ubuntu/ trusty/main libxml2-dev amd64 2.9.1+dfsg1-3ubuntu4 [628 kB]
Fetched 2023 kB in 34s (58.1 kB/s)
E: Failed to fetch http://ppa.launchpad.net/ondrej/php5-5.6/ubuntu/pool/main/o/openssl/openssl_1.0.2h-1+deb.sury.org~trusty+1_amd64.deb 404 Not Found
E: Failed to fetch http://ppa.launchpad.net/ondrej/php5-5.6/ubuntu/pool/main/p/php5/php5-curl_5.6.23+dfsg-1+deprecated+dontuse+deb.sury.org~trusty+1_amd64.deb 404 Not Found
E: Failed to fetch http://ppa.launchpad.net/ondrej/php5-5.6/ubuntu/pool/main/p/php5/php5-sybase_5.6.23+dfsg-1+deprecated+dontuse+deb.sury.org~trusty+1_amd64.deb 404 Not Found
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?
ERROR: Service 'php' failed to build: The command '/bin/sh -c apt-get install -y php5-curl php5-sybase freetds-dev libxml2-dev' returned a non-zero code: 100
This is the docker file:
FROM pvlltvk/ubuntu-trusty-php-fpm-5.6
RUN apt-get install -y \
php5-curl \
php5-sybase \
freetds-dev \
libxml2-dev
ADD freetds.conf /etc/freetds/freetds.conf
RUN echo 'alias sf="php /app/app/console"' >> ~/.bashrc
WORKDIR /app
If I run sudo cat /etc/default/docker:
DOCKER_OPTS="-dns 8.8.8.8 -dns 8.8.4.4"
Docker images do not include a package repository cache, they take up disk space and would quickly become out of date. It looks like you're building from an image that included a stale repository cache. Change your run command to pull the current repository status, run non-interactively, and cleanup when finished:
RUN apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y \
php5-curl \
php5-sybase \
freetds-dev \
libxml2-dev \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
See the best practices for more details.

Resources