CI/CD package is different from local package [jessie/stretch inconsistency] - docker

When I run docker on local machine with following Dockerfile:
FROM python:3
WORKDIR /app
COPY . /app
RUN apt-get update && apt-get install -y libhunspell-1.3-0
RUN pip install -r requirements.txt
EXPOSE 9876
CMD ["python","flask_compose.py"]
It got libhunspell from following repository (jessie):
Get:1 http://security.debian.org jessie/updates InRelease [94.4 kB]
Ign http://deb.debian.org jessie InRelease
Get:2 http://deb.debian.org jessie-updates InRelease [145 kB]
Get:3 http://security.debian.org jessie/updates/main amd64 Packages [623 kB]
Get:4 http://deb.debian.org jessie Release.gpg [2434 B]
Get:5 http://deb.debian.org jessie Release [148 kB]
Get:6 http://deb.debian.org jessie-updates/main amd64 Packages [23.0 kB]
Get:7 http://deb.debian.org jessie/main amd64 Packages [9064 kB]
And everything is fine (image build and run successfully).
Unfortunately, when I run docker on gitlab repository with the same Dockerfile it calls update apt-get from another repository (stretch):
Ign:1 http://deb.debian.org/debian stretch InRelease
Get:2 http://security.debian.org/debian-security stretch/updates InRelease [94.3 kB]
Get:3 http://deb.debian.org/debian stretch-updates InRelease [91.0 kB]
Get:4 http://deb.debian.org/debian stretch Release [118 kB]
Get:5 http://deb.debian.org/debian stretch Release.gpg [2434 B]
Get:6 http://security.debian.org/debian-security stretch/updates/main amd64 Packages [440 kB]
Get:7 http://deb.debian.org/debian stretch-updates/main amd64 Packages [12.1 kB]
Get:8 http://deb.debian.org/debian stretch/main amd64 Packages [9530 kB]
Due to this inconsistency gitlab CI/CD throws following exception:
E: Unable to locate package libhunspell-1.3-0
E: Couldn't find any package by glob 'libhunspell-1.3-0'
E: Couldn't find any package by regex 'libhunspell-1.3-0'
The command '/bin/sh -c apt-get install -y libhunspell-1.3-0' returned a non-zero code: 100
ERROR: Job failed: exit code 100
Does anyone knows how change my Dockerfile that local and gitlab uses the same package repository?

There current tag for python:3 points to a Debian stretch based image. To update your local environment, run a docker pull python:3 or run your build with the --pull option.
You can also select a more specific tag to force your desired base image used by python. See the docker hub page for python to see all the possible tags, e.g. python:3-jessie.

From gitlab official forum I found a solution which fixed my problem.
1) define a setup.sh file and following command:
echo "deb http://pkg.adfinis-sygroup.ch/debian/ jessie main non-free contrib" > /etc/apt/sources.list
echo "deb http://security.debian.org/ jessie/updates main" >> /etc/apt/sources.list
echo "deb http://pkg.adfinis-sygroup.ch/debian/ jessie-updates main contrib non-free" >> /etc/apt/sources.list
apt-get update
apt-get install --no-install-recommends -y libhunspell-1.3-0
2) In Dockerfile add following commands:
From python:3
ADD setup.sh /opt/
RUN /bin/bash /opt/setup.sh
PS: Although my hack works very fine, I prefer #BMitch solution.
--------------------------------------------------------------------------------------------------------
By extending #Bmitch solution I decrease image size from ~600 to ~150 with following Dockerfile:
FROM python:3-slim-jessie
WORKDIR .
# hunspell deps
RUN apt-get update && apt-get install --no-install-recommends -y libtool libc6-dev gcc g++ build-essential libhunspell-1.3-0
COPY requirements.txt requirements.txt
RUN pip install -r requirements.txt
COPY . .
CMD ["python","flask_compose.py"]

Related

Pyodbc not installing in Docker image

I'm trying to use a Docker image with SQLAlchemy, which have dependencies with pyodbc. I'm trying to get the package installed from the Dockerfile, but I'm not finding the solution anywhere.
Right now, the basic structure of the directory could be like this:
root
| notebooks
| |testAlchemy.ipynb
| Dockerfile
| docker-compose.yml
| requirements.txt
Here are the contents of requirements.txt:
ipython-sql
pyodbc
psycopg2
sqlalchemy
Here my dockerfile:
FROM jupyter/datascience-notebook:latest
USER root
RUN apt-get update && \
apt-get install -y libpq-dev build-essential && \
apt-get clean && rm -rf var/lib/apt/lists/*
COPY requirements.txt requirements.txt
RUN pip install -r requirements.txt
VOLUME /notebooks
WORKDIR /notebooks
And here the docker-compose:
version: "3"
services:
jupyter:
build:
context: ./jupyter
ports:
- "8888:8888"
links:
- postgres
environment:
- JUPYTER_TOKEN=1234
volumes:
- "./notebooks:/notebooks"
- "./data:/data"
postgres:
image: postgres
restart: always
environment:
POSTGRES_USER: user
POSTGRES_PASSWORD: passw
ports:
- 5432:5432
Then I do docker compose up and connect to jupyter server
In the notebook I have a really simple code:
from sqlalchemy.engine import URL
from sqlalchemy import create_engine
connection_string = f"DATABASE=operational;UID=user;PWD=passw;HOST=postgres"
connection_url = URL.create("mssql+pyodbc", query={"odbc_connect": connection_string})
engine = create_engine(connection_url)
But every time I try to run this code I get this error:
moduleNotFoundError img
And obviously, if I run !pip list in the notebook, pyodbc doesn't show anywhere. But I can run !pip install pyodbc with no problem
I'm sure I'm doing something wrong, but I don't know what.
Maybe try this recipe from their site, linked below, this is the CONDA+requirements file version:
FROM jupyter/datascience-notebook:latest
USER root
RUN apt-get update && \
apt-get install -y libpq-dev build-essential && \
apt-get clean && rm -rf var/lib/apt/lists/*
COPY --chown=${NB_UID}:${NB_GID} connect.py "/home/${NB_USER}"
COPY --chown=${NB_UID}:${NB_GID} requirements.txt /tmp/
#RUN pip install --quiet --no-cache-dir --requirement /tmp/requirements.txt && \
# fix-permissions "${CONDA_DIR}" && \
# fix-permissions "/home/${NB_USER}"
RUN mamba install --yes --file /tmp/requirements.txt && \
mamba clean --all -f -y && \
fix-permissions "${CONDA_DIR}" && \
fix-permissions "/home/${NB_USER}"
VOLUME /notebooks
WORKDIR /notebooks
using-mamba-install-or-pip-install-in-a-child-docker-image
Output
$ docker build --no-cache .
Sending build context to Docker daemon 42.06MB
Step 1/8 : FROM jupyter/datascience-notebook:latest
---> 03fcab0a8478
Step 2/8 : USER root
---> Running in a064e6e68110
Removing intermediate container a064e6e68110
---> f1681b20edb3
Step 3/8 : RUN apt-get update && apt-get install -y libpq-dev build-essential && apt-get clean && rm -rf var/lib/apt/lists/*
---> Running in 4622166e35a4
Get:1 http://security.ubuntu.com/ubuntu jammy-security InRelease [110 kB]
Get:2 http://archive.ubuntu.com/ubuntu jammy InRelease [270 kB]
Get:3 http://archive.ubuntu.com/ubuntu jammy-updates InRelease [114 kB]
Get:4 http://security.ubuntu.com/ubuntu jammy-security/universe amd64 Packages [767 kB]
Get:5 http://archive.ubuntu.com/ubuntu jammy-backports InRelease [99.8 kB]
Get:6 http://archive.ubuntu.com/ubuntu jammy/restricted amd64 Packages [164 kB]
Get:7 http://archive.ubuntu.com/ubuntu jammy/main amd64 Packages [1,792 kB]
Get:8 http://security.ubuntu.com/ubuntu jammy-security/main amd64 Packages [614 kB]
Get:9 http://security.ubuntu.com/ubuntu jammy-security/multiverse amd64 Packages [4,642 B]
Get:10 http://security.ubuntu.com/ubuntu jammy-security/restricted amd64 Packages [522 kB]
Get:11 http://archive.ubuntu.com/ubuntu jammy/multiverse amd64 Packages [266 kB]
Get:12 http://archive.ubuntu.com/ubuntu jammy/universe amd64 Packages [17.5 MB]
Get:13 http://archive.ubuntu.com/ubuntu jammy-updates/restricted amd64 Packages [573 kB]
Get:14 http://archive.ubuntu.com/ubuntu jammy-updates/multiverse amd64 Packages [8,056 B]
Get:15 http://archive.ubuntu.com/ubuntu jammy-updates/main amd64 Packages [914 kB]
Get:16 http://archive.ubuntu.com/ubuntu jammy-updates/universe amd64 Packages [952 kB]
Get:17 http://archive.ubuntu.com/ubuntu jammy-backports/universe amd64 Packages [7,275 B]
Get:18 http://archive.ubuntu.com/ubuntu jammy-backports/main amd64 Packages [3,175 B]
Fetched 24.7 MB in 5s (5,102 kB/s)
Reading package lists...
Reading package lists...
Building dependency tree...
Reading state information...
build-essential is already the newest version (12.9ubuntu3).
The following additional packages will be installed:
libpq5 libssl-dev
Suggested packages:
postgresql-doc-14 libssl-doc
The following NEW packages will be installed:
libpq-dev libpq5 libssl-dev
0 upgraded, 3 newly installed, 0 to remove and 5 not upgraded.
Need to get 2,659 kB of archives.
After this operation, 13.4 MB of additional disk space will be used.
Get:1 http://archive.ubuntu.com/ubuntu jammy-updates/main amd64 libpq5 amd64 14.5-0ubuntu0.22.04.1 [140 kB]
Get:2 http://archive.ubuntu.com/ubuntu jammy-updates/main amd64 libssl-dev amd64 3.0.2-0ubuntu1.7 [2,372 kB]
Get:3 http://archive.ubuntu.com/ubuntu jammy-updates/main amd64 libpq-dev amd64 14.5-0ubuntu0.22.04.1 [147 kB]
debconf: delaying package configuration, since apt-utils is not installed
Fetched 2,659 kB in 1s (2,739 kB/s)
Selecting previously unselected package libpq5:amd64.
(Reading database ... 49774 files and directories currently installed.)
Preparing to unpack .../libpq5_14.5-0ubuntu0.22.04.1_amd64.deb ...
Unpacking libpq5:amd64 (14.5-0ubuntu0.22.04.1) ...
Selecting previously unselected package libssl-dev:amd64.
Preparing to unpack .../libssl-dev_3.0.2-0ubuntu1.7_amd64.deb ...
Unpacking libssl-dev:amd64 (3.0.2-0ubuntu1.7) ...
Selecting previously unselected package libpq-dev.
Preparing to unpack .../libpq-dev_14.5-0ubuntu0.22.04.1_amd64.deb ...
Unpacking libpq-dev (14.5-0ubuntu0.22.04.1) ...
Setting up libpq5:amd64 (14.5-0ubuntu0.22.04.1) ...
Setting up libssl-dev:amd64 (3.0.2-0ubuntu1.7) ...
Setting up libpq-dev (14.5-0ubuntu0.22.04.1) ...
Processing triggers for libc-bin (2.35-0ubuntu3.1) ...
Removing intermediate container 4622166e35a4
---> 1c46f27c2516
Step 4/8 : COPY --chown=${NB_UID}:${NB_GID} connect.py "/home/${NB_USER}"
---> acab4c589e51
Step 5/8 : COPY --chown=${NB_UID}:${NB_GID} requirements.txt /tmp/
---> 3b506e4bdd02
Step 6/8 : RUN mamba install --yes --file /tmp/requirements.txt && mamba clean --all -f -y && fix-permissions "${CONDA_DIR}" && fix-permissions "/home/${NB_USER}"
---> Running in ced464550b21
Transaction
Prefix: /opt/conda
Updating specs:
- ipython-sql
- pyodbc
- psycopg2
- sqlalchemy
- ca-certificates
- certifi
- openssl
Package Version Build Channel Size
───────────────────────────────────────────────────────────────────────────
Install:
───────────────────────────────────────────────────────────────────────────
+ ipython-sql 0.3.9 pyhd8ed1ab_1004 conda-forge/noarch 19kB
+ libpq 14.5 he2d8382_1 conda-forge/linux-64 3MB
+ prettytable 3.4.1 pyhd8ed1ab_0 conda-forge/noarch 27kB
+ psycopg2 2.9.3 py310h5764c6d_1 conda-forge/linux-64 185kB
+ pyodbc 4.0.35 py310hd8f1fbe_0 conda-forge/linux-64 79kB
+ sqlparse 0.4.3 pyhd8ed1ab_0 conda-forge/noarch 36kB
Summary:
Install: 6 packages
Total download: 3MB
───────────────────────────────────────────────────────────────────────────
Looking for: ['ipython-sql', 'pyodbc', 'psycopg2', 'sqlalchemy']
Pinned packages:
- python 3.10.*
- python 3.10.6
Preparing transaction: ...working... done
Verifying transaction: ...working... done
Executing transaction: ...working... done
Will remove 1 package cache(s).
Removing intermediate container ced464550b21
---> ddfbf0e82d8a
Step 7/8 : VOLUME /notebooks
---> Running in 6991a675e302
Removing intermediate container 6991a675e302
---> 1cadb017d264
Step 8/8 : WORKDIR /notebooks
---> Running in 44b9027d2e6d
Removing intermediate container 44b9027d2e6d
---> c888d15b3e82
Successfully built c888d15b3e82

install zeppelin with spark in docker-compose

I was trying to install zeppelin as shown in this dockerfile, but with a different version of spark and hadoop (see this dockerfile in my repo for more details). However, I am getting the following error log when running apt-get update:
Step 5/10 : RUN apt-get update
---> Running in 1ee84513acc7
Ign http://ftp.debian.org jessie-backports InRelease
Ign http://ftp.debian.org jessie-backports Release.gpg
Ign http://deb.debian.org jessie InRelease
Ign http://ftp.debian.org jessie-backports Release
Get:1 http://security.debian.org jessie/updates InRelease [44.9 kB]
Err http://ftp.debian.org jessie-backports/main amd64 Packages
Get:2 http://deb.debian.org jessie-updates InRelease [16.3 kB]
Err http://ftp.debian.org jessie-backports/main amd64 Packages
Err http://ftp.debian.org jessie-backports/main amd64 Packages
Get:3 http://deb.debian.org jessie Release.gpg [1652 B]
Err http://ftp.debian.org jessie-backports/main amd64 Packages
Get:4 http://deb.debian.org jessie-updates/main amd64 Packages [20 B]
Get:5 http://security.debian.org jessie/updates/main amd64 Packages [992 kB]
Err http://ftp.debian.org jessie-backports/main amd64 Packages
404 Not Found
Get:6 http://deb.debian.org jessie Release [77.3 kB]
Get:7 http://deb.debian.org jessie/main amd64 Packages [9098 kB]
W: Size of file /var/lib/apt/lists/deb.debian.org_debian_dists_jessie-updates_main_binary-amd64_Packages.gz is not what the server reported 20 23046
W: Failed to fetch http://ftp.debian.org/debian/dists/jessie-backports/main/binary-amd64/Packages 404 Not Found
E: Some index files failed to download. They have been ignored, or old ones used instead.
Fetched 10.2 MB in 1s (7375 kB/s)
The command '/bin/sh -c apt-get update' returned a non-zero code: 100
ERROR: Service 'zeppelin' failed to build
It seems like this is somehow related to the jessie package. I read this and this article and I tried including
RUN echo "deb [check-valid-until=no] http://cdn-fastly.deb.debian.org/debian jessie main" > /etc/apt/sources.list.d/jessie.list
RUN echo "deb [check-valid-until=no] http://archive.debian.org/debian jessie-backports main" > /etc/apt/sources.list.d/jessie-backports.list
RUN sed -i '/deb http:\/\/deb.debian.org\/debian jessie-updates main/d' /etc/apt/sources.list
RUN apt-get -o Acquire::Check-Valid-Until=false update
script before the apt-get update command in the dockerfile of my repo, but still without success.

"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

Resources