Install php7.0-pgsql inside docker php:7.0-apache - docker

I try to install php7.0-pgsql inside my php:7.0-apache image.
I know there are a lot of comparable issues on the internet but I really need help for this:
FROM php:7.0-apache
RUN apt-get -y update && \
apt-get -y install software-properties-common locales locales-all && \
LC_ALL=en_US.UTF-8 add-apt-repository ppa:ondrej/php && \
apt-get -y update && \
apt-get -y install php7.0-pgsql
COPY src/ /var/www/html
The following error appears during my docker build:
# LC_ALL=C.UTF-8 add-apt-repository ppa:ondrej/php
More info: https://launchpad.net/~ondrej/+archive/ubuntu/php
gpg: keyring `/tmp/tmppxe6egn8/secring.gpg' created
gpg: keyring `/tmp/tmppxe6egn8/pubring.gpg' created
gpg: requesting key E5267A6C from hkp server keyserver.ubuntu.com
gpg: /tmp/tmppxe6egn8/trustdb.gpg: trustdb created
gpg: key E5267A6C: public key "Launchpad PPA for Ondřej Surý" imported
gpg: Total number processed: 1
gpg: imported: 1 (RSA: 1)
OK
Hit http://security.debian.org jessie/updates InRelease
Ign http://ppa.launchpad.net jessie InRelease
Ign http://ppa.launchpad.net jessie Release.gpg
Get:1 http://security.debian.org jessie/updates/main amd64 Packages [549 kB]
Ign http://ppa.launchpad.net jessie Release
Err http://ppa.launchpad.net jessie/main amd64 Packages
Ign http://deb.debian.org jessie InRelease
Err http://ppa.launchpad.net jessie/main amd64 Packages
Hit http://deb.debian.org jessie-updates InRelease
Hit http://deb.debian.org jessie Release.gpg
Err http://ppa.launchpad.net jessie/main amd64 Packages
Err http://ppa.launchpad.net jessie/main amd64 Packages
Hit http://deb.debian.org jessie Release
Err http://ppa.launchpad.net jessie/main amd64 Packages
404 Not Found
Get:2 http://deb.debian.org jessie-updates/main amd64 Packages [17.8 kB]
Get:3 http://deb.debian.org jessie/main amd64 Packages [9063 kB]
Fetched 9630 kB in 11s (870 kB/s)
W: Failed to fetch http://ppa.launchpad.net/ondrej/php/ubuntu/dists/jessie/main/binary-amd64/Packages 404 Not Found
E: Some index files failed to download. They have been ignored, or old ones used instead.
The command '/bin/sh -c apt-get -y update && apt-get -y install software-properties-common locales locales-all && LC_ALL=en_US.UTF-8 add-apt-repository ppa:ondrej/php && apt-get -y update && apt-get -y install php7.0-pgsql' returned a non-zero code: 100

Here an excerpt from a Dockerfile I am using
FROM php:7.1-apache
RUN apt-get update \
&& apt-get install --no-install-recommends -y libpq-dev \
&& docker-php-ext-install pgsql \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
I am compiling the extensions myself since the PHP within the official images is also compiled from source and not taken from the Debian repository.

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

for docker that used to work The command `bin/sh` returned a non-zero code: 100

I have a dockerfile
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
and it fails with ##[error]The command '/bin/sh -c apt-get update && apt-get install -y --no-install-recommends build-essential libpq-dev python3.8 python3-pip python3-setuptools python3-dev' returned a non-zero code: 100
This used to work a couple weeks ago.
Any suggestions how to remedy this?
complete error message:
2022-11-10T09:18:40.5040462Z Get:1 http://security.ubuntu.com/ubuntu jammy-security InRelease [110 kB]
2022-11-10T09:18:40.5801563Z Get:2 http://archive.ubuntu.com/ubuntu jammy InRelease [270 kB]
2022-11-10T09:18:40.5879776Z Get:3 http://security.ubuntu.com/ubuntu jammy-security/multiverse amd64 Packages [13.6 kB]
2022-11-10T09:18:40.5948497Z Get:4 http://archive.ubuntu.com/ubuntu jammy-updates InRelease [114 kB]
2022-11-10T09:18:40.5954474Z Get:5 http://archive.ubuntu.com/ubuntu jammy-backports InRelease [99.8 kB]
2022-11-10T09:18:40.5997954Z Get:6 http://security.ubuntu.com/ubuntu jammy-security/restricted amd64 Packages [480 kB]
2022-11-10T09:18:40.6041090Z Get:7 http://security.ubuntu.com/ubuntu jammy-security/universe amd64 Packages [761 kB]
2022-11-10T09:18:40.6109038Z Get:8 http://security.ubuntu.com/ubuntu jammy-security/main amd64 Packages [580 kB]
2022-11-10T09:18:40.6917686Z Get:9 http://archive.ubuntu.com/ubuntu jammy/universe amd64 Packages [17.5 MB]
2022-11-10T09:18:40.8476470Z Get:10 http://archive.ubuntu.com/ubuntu jammy/main amd64 Packages [1,792 kB]
2022-11-10T09:18:40.8636712Z Get:11 http://archive.ubuntu.com/ubuntu jammy/multiverse amd64 Packages [266 kB]
2022-11-10T09:18:40.8670910Z Get:12 http://archive.ubuntu.com/ubuntu jammy/restricted amd64 Packages [164 kB]
2022-11-10T09:18:40.8688797Z Get:13 http://archive.ubuntu.com/ubuntu jammy-updates/restricted amd64 Packages [528 kB]
2022-11-10T09:18:40.8735637Z Get:14 http://archive.ubuntu.com/ubuntu jammy-updates/main amd64 Packages [881 kB]
2022-11-10T09:18:40.8808270Z Get:15 http://archive.ubuntu.com/ubuntu jammy-updates/multiverse amd64 Packages [16.9 kB]
2022-11-10T09:18:40.8815528Z Get:16 http://archive.ubuntu.com/ubuntu jammy-updates/universe amd64 Packages [944 kB]
2022-11-10T09:18:40.8887164Z Get:17 http://archive.ubuntu.com/ubuntu jammy-backports/universe amd64 Packages [7,277 B]
2022-11-10T09:18:40.8893189Z Get:18 http://archive.ubuntu.com/ubuntu jammy-backports/main amd64 Packages [3,175 B]
2022-11-10T09:18:41.9120598Z Fetched 24.5 MB in 1s (17.3 MB/s)
2022-11-10T09:18:42.6535417Z Reading package lists...
2022-11-10T09:18:43.4353411Z Reading package lists...
2022-11-10T09:18:43.6303192Z Building dependency tree...
2022-11-10T09:18:43.6304720Z Reading state information...
2022-11-10T09:18:43.6364217Z Package python3.8 is not available, but is referred to by another package.
2022-11-10T09:18:43.6364814Z This may mean that the package is missing, has been obsoleted, or
2022-11-10T09:18:43.6365218Z is only available from another source
2022-11-10T09:18:43.6365378Z
2022-11-10T09:18:43.6389109Z [91mE: Package 'python3.8' has no installation candidate
2022-11-10T09:18:43.8543258Z [0mThe command '/bin/sh -c apt-get update && apt-get install -y --no-install-recommends build-essential libpq-dev python3.8 python3-pip python3-setuptools python3-dev' returned a non-zero code: 100
2022-11-10T09:18:43.8608722Z ##[error]The command '/bin/sh -c apt-get update && apt-get install -y --no-install-recommends build-essential libpq-dev python3.8 python3-pip python3-setuptools python3-dev' returned a non-zero code: 100
2022-11-10T09:18:43.8643823Z ##[error]The process '/usr/bin/docker' failed with exit code 100
2022-11-10T09:18:43.8710459Z ##[section]Finishing: Build and push an image to container registry
I changed the 3rd line to
RUN apt-get update && apt-get install -y --no-install-recommends build-essential libpq-dev python3.9 python3-pip python3-setuptools python3-dev
and it worked.
Still don't know why 3.8 stopped working though

Dockerfile error: The repository 'http://dl.google.com/linux/chrome/deb stable InRelease' is not signed

This dockerfile works when line 4 (case 1) is uncommented, but fails when line 5 (case 2) is uncommented. I have very puzzled by this. The error (if I understand it) should happen in both cases. See the error trace below.
Dockerfile - Case 1 works, case 2 fails
# This is an auto generated Dockerfile for ros:ros-core
# generated from docker_images/create_ros_core_image.Dockerfile.em
# Case 1: Works FROM ubuntu:focal
# Case 2: Gives error FROM dorowu/ubuntu-desktop-lxde-vnc:focal
# setup timezone
RUN apt-get update && \
apt-get install -q -y --no-install-recommends tzdata && \
rm -rf /var/lib/apt/lists/*
# install packages
RUN apt-get update && apt-get install -q -y --no-install-recommends \
dirmngr \
gnupg2 \
&& rm -rf /var/lib/apt/lists/*
# setup sources.list
RUN echo "deb http://packages.ros.org/ros/ubuntu focal main" > /etc/apt/sources.list.d/ros1-latest.list
# setup keys
RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654
# setup environment
ENV LANG C.UTF-8
ENV LC_ALL C.UTF-8
ENV ROS_DISTRO noetic
# install ros packages
RUN apt-get update && apt-get install -y --no-install-recommends \
ros-noetic-ros-core=1.5.0-1* \
&& rm -rf /var/lib/apt/lists/*
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \
ros-noetic-desktop-full
Error Trace
+] Building 0.9s (6/11)
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 1.21kB 0.0s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> [internal] load metadata for docker.io/dorowu/ubuntu-desktop-lxde-vnc:focal 0.5s
=> [auth] dorowu/ubuntu-desktop-lxde-vnc:pull token for registry-1.docker.io 0.0s
=> CACHED [1/7] FROM docker.io/dorowu/ubuntu-desktop-lxde-vnc:focal#sha256:07e51eafb 0.0s
=> ERROR [2/7] RUN echo 'Etc/UTC' > /etc/timezone && ln -s /usr/share/zoneinfo/E 0.3s
------
> [2/7] RUN echo 'Etc/UTC' > /etc/timezone && ln -s /usr/share/zoneinfo/Etc/UTC /etc/localtime && apt-get update && apt-get install -q -y --no-install-recommends tzdata && rm -rf /var/lib/apt/lists/*:
#6 0.307 ln: failed to create symbolic link '/etc/localtime': File exists
------
executor failed running [/bin/sh -c echo 'Etc/UTC' > /etc/timezone && ln -s /usr/share/zoneinfo/Etc/UTC /etc/localtime && apt-get update && apt-get install -q -y --no-install-recommends tzdata && rm -rf /var/lib/apt/lists/*]: exit code: 1
~/mydev/dockerplay docker build -t dockerplay3 .
[+] Building 18.5s (5/10)
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 1.11kB 0.0s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> [internal] load metadata for docker.io/dorowu/ubuntu-desktop-lxde-vnc:focal 0.2s
=> CACHED [1/7] FROM docker.io/dorowu/ubuntu-desktop-lxde-vnc:focal#sha256:07e51eafb 0.0s
=> ERROR [2/7] RUN apt-get update && apt-get install -q -y --no-install-recomme 18.2s
------
> [2/7] RUN apt-get update && apt-get install -q -y --no-install-recommends tzdata && rm -rf /var/lib/apt/lists/*:
#5 1.045 Get:1 http://dl.google.com/linux/chrome/deb stable InRelease [1811 B]
#5 1.046 Get:2 http://security.ubuntu.com/ubuntu focal-security InRelease [114 kB]
#5 1.136 Get:3 http://mirrors.ubuntu.com/mirrors.txt Mirrorlist [3393 B]
#5 1.498 Get:4 http://ubuntu.mirror.frontiernet.net/ubuntu focal InRelease [265 kB]
#5 1.612 Ign:6 https://atl.mirrors.clouvider.net/ubuntu focal-backports InRelease
#5 1.651 Get:5 http://mirrors.xmission.com/ubuntu focal-updates InRelease [114 kB]
#5 1.817 Get:6 http://mirrors.gigenet.com/ubuntuarchive focal-backports InRelease [108 kB]
#5 2.547 Err:1 http://dl.google.com/linux/chrome/deb stable InRelease
#5 2.547 The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 4EB27DB2A3B88B8B
#5 3.783 Get:7 http://security.ubuntu.com/ubuntu focal-security/main amd64 Packages [2031 kB]
#5 4.116 Get:8 http://security.ubuntu.com/ubuntu focal-security/multiverse amd64 Packages [27.5 kB]
#5 4.120 Get:9 http://security.ubuntu.com/ubuntu focal-security/universe amd64 Packages [883 kB]
#5 4.229 Get:10 http://security.ubuntu.com/ubuntu focal-security/restricted amd64 Packages [1398 kB]
#5 5.734 Get:13 http://mirror.team-cymru.com/ubuntu focal/universe amd64 Packages [11.3 MB]
#5 5.738 Get:11 http://mirror.uoregon.edu/ubuntu focal/restricted amd64 Packages [33.4 kB]
#5 5.772 Get:14 http://mirrors.arpnetworks.com/Ubuntu focal/multiverse amd64 Packages [177 kB]
#5 5.881 Ign:12 https://mirror.us.leaseweb.net/ubuntu focal/main amd64 Packages
#5 6.256 Get:12 http://mirror.metrocast.net/ubuntu focal/main amd64 Packages [1275 kB]
#5 6.749 Ign:15 http://ftp.usf.edu/pub/ubuntu focal-updates/restricted amd64 Packages
#5 6.837 Ign:15 http://mirrors.arpnetworks.com/Ubuntu focal-updates/restricted amd64 Packages
#5 6.967 Get:17 http://mirrors.namecheap.com/ubuntu focal-updates/universe amd64 Packages [1161 kB]
#5 7.214 Ign:16 https://mirrors.ocf.berkeley.edu/ubuntu-ports focal-updates/multiverse amd64 Packages
#5 7.575 Ign:15 https://mirrors.tscak.com/ubuntu focal-updates/restricted amd64 Packages
#5 8.978 Get:18 http://www.gtlib.gatech.edu/pub/ubuntu focal-updates/main amd64 Packages [2479 kB]
#5 9.766 Get:16 http://repo.miserver.it.umich.edu/ubuntu focal-updates/multiverse amd64 Packages [30.2 kB]
#5 9.927 Get:15 http://mirror.us-ny2.kamatera.com/ubuntu focal-updates/restricted amd64 Packages [1511 kB]
#5 10.24 Get:19 http://reflector.westga.edu/repos/Ubuntu/archive focal-backports/main amd64 Packages [54.2 kB]
#5 10.49 Ign:20 http://mirror.enzu.com/ubuntu focal-backports/universe amd64 Packages
#5 10.85 Ign:20 https://ubuntu.mirror.shastacoe.net/ubuntu focal-backports/universe amd64 Packages
#5 11.07 Ign:20 https://mirrors.ocf.berkeley.edu/ubuntu-ports focal-backports/universe amd64 Packages
#5 11.24 Get:20 http://mirror.umd.edu/ubuntu focal-backports/universe amd64 Packages [27.1 kB]
#5 13.98 Reading package lists...
#5 18.18 W: GPG error: http://dl.google.com/linux/chrome/deb stable InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 4EB27DB2A3B88B8B
#5 18.18 E: The repository 'http://dl.google.com/linux/chrome/deb stable InRelease' is not signed.
------
executor failed running [/bin/sh -c apt-get update && apt-get install -q -y --no-install-recommends tzdata && rm -rf /var/lib/apt/lists/*]: exit code: 100
I believe the public keys for the mentioned repository changed recently, or something like that. Quick fix:
wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
Then try again.
I haven't solver this. But I made it go away by removing the lines totally and adding these instead (which I got from another Dockerfile):
RUN apt-get install -y wget
RUN wget -q https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
RUN apt-get install ./google-chrome-stable_current_amd64.deb

Docker: Unable to correct problems, you have held broken packages

I have Dockerfile that I have used many times without an issue. Now I need to add some packages to it (ssmtp and sendmail) and when I add them the build fails with:
Sending build context to Docker daemon 645.3 MB
Sending build context to Docker daemon
Step 0 : FROM debian:jessie
---> 736e5442e772
Step 1 : MAINTAINER Larry Martell <larry.martell#foo.com>
---> Using cache
---> bd272aa26940
Step 2 : ENV HOME /opt/django/CAPgraph/
---> Using cache
---> 1c540ed91808
Step 3 : RUN echo "deb http://http.debian.net/debian jessie-backports main" >> /etc/apt/sources.list
---> Using cache
---> 8788d48e625d
Step 4 : RUN (apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y build-essential git python python-dev python-setuptools nginx sqlite3 supervisor mysql-server libmysqlclient-dev vim cron unzip software-properties-common python-software-properties openjdk-8-jre xvfb wkhtmltopdf ssmtp sendmail)
---> Running in 8986bca93fdb
Get:1 http://security.debian.org jessie/updates InRelease [63.1 kB]
Get:2 http://security.debian.org jessie/updates/main amd64 Packages [436 kB]
Get:3 http://http.debian.net jessie-backports InRelease [166 kB]
Get:4 http://httpredir.debian.org jessie-updates InRelease [145 kB]
Get:5 http://http.debian.net jessie-backports/main amd64 Packages [1031 kB]
Get:6 http://httpredir.debian.org jessie-updates/main amd64 Packages [17.6 kB]
Ign http://httpredir.debian.org jessie InRelease
Get:7 http://httpredir.debian.org jessie Release.gpg [2373 B]
Get:8 http://httpredir.debian.org jessie Release [148 kB]
Get:9 http://httpredir.debian.org jessie/main amd64 Packages [9049 kB]
Fetched 11.1 MB in 9s (1211 kB/s)
Reading package lists...
Reading package lists...
Building dependency tree...
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
sendmail : Depends: sendmail-bin but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
The command '/bin/sh -c (apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y build-essential git python python-dev python-setuptools nginx sqlite3 supervisor mysql-server libmysqlclient-dev vim cron unzip software-properties-common python-software-properties openjdk-8-jre xvfb wkhtmltopdf ssmtp sendmail)' returned a non-zero code: 100
If I add those packages to the list I then complains about others. What does this 'held broken packages' message mean and how do I fix it?
Here is the first part of my Dockerfile:
FROM debian:jessie ENV HOME /opt/django/CAPgraph/
RUN echo "deb http://http.debian.net/debian jessie-backports main" >> /etc/apt/sources.list
RUN (apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y build-essential git python python-dev python-setuptools nginx sqlite3 supervisor mysql-server libmysqlclient-dev vim cron unzip software-properties-common python-software-properties openjdk-8-jre xvfb wkhtmltopdf sendmail ssmtp)
I tried adding sendmail-bin and then it failed with:
The following packages have unmet dependencies:
sendmail-bin : Conflicts: mail-transport-agent
ssmtp : Conflicts: mail-transport-agent
E: Unable to correct problems, you have held broken packages.
I then added mail-transport-agent and it failed with:
Package mail-transport-agent is a virtual package provided by:
opensmtpd 5.7.3p2-1~bpo8+1
ssmtp 2.64-8
sendmail-bin 8.14.4-8+deb8u1
qmail-run 2.0.2+nmu1
postfix 2.11.3-1
nullmailer 1:1.13-1+deb8u1
msmtp-mta 1.4.32-2
masqmail 0.2.30-1
lsb-invalid-mta 4.1+Debian13+nmu1
exim4-daemon-light 4.84.2-2+deb8u3
exim4-daemon-heavy 4.84.2-2+deb8u3
esmtp-run 1.2-12
dma 0.9-1
courier-mta 0.73.1-1.6
citadel-mta 8.24-1+b3
E: Package 'mail-transport-agent' has no installation candidate
Debian is setup to only allow one mail transport agent, and your install command is trying to include two, ssmtp and sendmail/sendmail-bin. Since they conflict with each other, you'll need to remove one of these from your install command.
If the sendmail dependency is so your Python app can send email via the sendmail binary, just install ssmtp and configure it to use an external MTA.
Trying to run sendmail in a Docker container is not recommended

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