The repository 'http://apt.postgresql.org/pub/repos/apt stretch-pgdg Release' does not have a Release file? - postgresql

I have an error when I am building my Docker containers. It seems that there are problems with Postgres Stretch for Debian. I saw that Debian strech was removed and no longer supported.
I found similar problem here: The repository 'http://apt.postgresql.org/pub/repos/apt stretch-pgdg Release' does not have a Release file but i didn't managed to solve my problem.
Here is an error:
W: The repository 'http://apt.postgresql.org/pub/repos/apt stretch-pgdg Release' does not have a Release file.
E: Failed to fetch http://apt.postgresql.org/pub/repos/apt/dists/stretch-pgdg/11/binary-amd64/Packages 404 Not Found [IP: 147.75.85.69 80]
E: Some index files failed to download. They have been ignored, or old ones used instead.
ERROR: Service 'db' failed to build: The command '/bin/sh -c apt-get update && apt-get install dos2unix && apt-get clean' returned a non-zero code: 100
And here's part of my Dockerfile that I'm trying to run:
FROM debian:jessie
MAINTAINER Open Knowledge
# Install required system packages
RUN apt-get -q -y update \
&& DEBIAN_FRONTEND=noninteractive apt-get -q -y upgrade \
&& apt-get -q -y install \
curl \
python-dev \
python-pip \
python-virtualenv \
python-wheel \
libpq-dev \
libxml2-dev \
libxslt-dev \
libgeos-dev \
libssl-dev \
libxslt-dev \
libgeos-dev \
libssl-dev \
libffi-dev \
postgresql-client \
build-essential \
git-core \
vim \
wget \
&& apt-get -q clean \
&& apt-get install -y dos2unix
Do you maybe know what I should add or remove in my Dockerfile file to solve this problem?
Thanks in advance

Debian stretch is no longer supported
You could use this deb package instead:
deb https://apt-archive.postgresql.org/pub/repos/apt stretch-pgdg main

Related

Add mongo in my docker project I got ref error

I need to add mongo in my docker project, so in file Dockerfile.yml I added mongo packages:
FROM php:8.1.6-apache
RUN apt-get update && \
apt-get install --assume-yes --no-install-recommends --quiet \
python \
libfreetype6-dev \
libwebp-dev \
libjpeg62-turbo-dev \
libpng-dev \
libzip-dev \
nano \
mc \
git-core \
libmagickwand-dev \
curl \
gnupg2 \
// I ADDED THIS LINE
&& git clone https://www.mongodb.org/static/pgp/server-6.0.asc | apt-key add - && \
add-apt-repository 'deb https://repo.mongodb.org/apt/debian buster/mongodb-org/6.0 main' && \
mongodb-org-tools \
build-essential \
libnotify-bin \
openssl \
libssl-dev \
libgmp-dev \
libldap2-dev \
netcat \
locate \
# composer \
&& git clone https://github.com/nodejs/node.git && \
cd node \
&& git checkout v14.18.0 \
&& ./configure \
&& make \
&& make install
// I ADDED THIS LINE
RUN pecl install mongodb
RUN echo "extension=mongodb.so" >> /usr/local/etc/php/php.ini
RUN pecl install imagick \
&& docker-php-ext-enable imagick
But running command :
docker-compose up -d --build
I got error in the end of long output :
Setting up librsvg2-dev:amd64 (2.50.3+dfsg-1) ...
Setting up libmagickcore-6.q16-dev:amd64 (8:6.9.11.60+dfsg-1.3) ...
Setting up libmagickwand-6.q16-dev:amd64 (8:6.9.11.60+dfsg-1.3) ...
Setting up libmagickwand-dev (8:6.9.11.60+dfsg-1.3) ...
Processing triggers for libgdk-pixbuf-2.0-0:amd64 (2.42.2+dfsg-1+deb11u1) ...
Cloning into 'server-6.0.asc'...
Warning: apt-key is deprecated. Manage keyring files in trusted.gpg.d instead (see apt-key(8)).
fatal: repository 'https://www.mongodb.org/static/pgp/server-6.0.asc/' not found
gpg: no valid OpenPGP data found.
ERROR: Service 'web' failed to build: The command '/bin/sh -c apt-get update && apt-get install --assume-yes --no-install-recommends --quiet python libfreetype6-dev libwebp-dev libjpeg62-turbo-dev libpng-dev libzip-dev nano mc git-core libmagickwand-dev curl gnupg2
Looks like link
https://www.mongodb.org/static/pgp/server-6.0.asc/
is invalid (I found this mongo adding part script in net)...
Which is valid format of it ?
Updated parameter :
I replace command with wget -qO , but have an error in long output :
$ docker-compose up -d
Building web
[WARNING]: Empty continuation line found in:
RUN apt-get update && apt-get install --assume-yes --no-install-recommends --quiet python libfreetype6-dev libwebp-dev libjpeg62-turbo-dev libpng-dev libzip-dev nano mc git-core libmagickwand-dev curl gnupg2 wget -qO - https://www.mongodb.org/static/pgp/server-6.0.asc build-essential libnotify-bin openssl libssl-dev libgmp-dev libldap2-dev netcat locate && git clone https://github.com/nodejs/node.git && cd node && git checkout v14.18.0 && ./configure && make && make install
[WARNING]: Empty continuation lines will become errors in a future release.
Step 1/13 : FROM php:8.1.6-apache
---> af944036d594
Step 2/13 : RUN apt-get update && apt-get install --assume-yes --no-install-recommends --quiet python libfreetype6-dev libwebp-dev libjpeg62-turbo-dev libpng-dev libzip-dev nano mc git-core libmagickwand-dev curl gnupg2 wget -qO - https://www.mongodb.org/static/pgp/server-6.0.asc build-essential libnotify-bin openssl libssl-dev libgmp-dev libldap2-dev netcat locate && git clone https://github.com/nodejs/node.git && cd node && git checkout v14.18.0 && ./configure && make && make install
---> Running in 43469c40032e
Get:1 http://security.debian.org/debian-security bullseye-security InRelease [48.4 kB]
Get:2 http://deb.debian.org/debian bullseye InRelease [116 kB]
Get:3 http://deb.debian.org/debian bullseye-updates InRelease [44.1 kB]
Get:4 http://security.debian.org/debian-security bullseye-security/main amd64 Packages [216 kB]
Get:5 http://deb.debian.org/debian bullseye/main amd64 Packages [8183 kB]
Get:6 http://deb.debian.org/debian bullseye-updates/main amd64 Packages [14.6 kB]
Fetched 8622 kB in 2s (4302 kB/s)
Reading package lists...
E: Command line option 'O' [from -qO] is not understood in combination with the other options.
ERROR: Service 'web' failed to build: The command '/bin/sh -c apt-get update && apt-get install --assume-yes --no-install-recommends --quiet python libfreetype6-dev libwebp-dev libjpeg62-turbo-dev libpng-dev libzip-dev nano mc git-core libmagickwand-dev curl gnupg2 wget -qO - https://www.mongodb.org/static/pgp/server-6.0.asc build-essential libnotify-bin openssl libssl-dev libgmp-dev libldap2-dev netcat locate && git clone https://github.com/nodejs/node.git && cd node && git checkout v14.18.0 && ./configure && make && make install' returned a non-zero code: 100
Invalid option ?
Updated parameter #2 :
I added curl with mongo at the top of my Dockerfile.yml and installing mongodb-org below:
FROM php:8.1.6-apache
RUN curl -fsSL https://www.mongodb.org/static/pgp/server-6.0.asc
RUN apt-get update && \
apt-get install --assume-yes --no-install-recommends --quiet \
RUN apt-get install -y mongodb-org
....
RUN pecl install imagick \
&& docker-php-ext-enable imagick
But I got error :
Reading package lists...
Building dependency tree...
Reading state information...
E: Unable to locate package mongodb-org
ERROR: Service 'web' failed to build: The command '/bin/sh -c apt-get install -y mongodb-org' returned a non-zero code: 100
Some commands missed ?
Updated parameter # 3:
On page https://www.mongodb.com/docs/manual/tutorial/install-mongodb-on-ubuntu/ I read :
The following instruction is for Ubuntu 20.04 (Focal).
Create the /etc/apt/sources.list.d/mongodb-org-6.0.list file for
Ubuntu 20.04 (Focal):
echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu
focal/mongodb-org/6.0 multiverse" | tee
/etc/apt/sources.list.d/mongodb-org-6.0.list
So I modified Dockerfile.yml :
FROM php:8.1.6-apache
RUN curl -fsSL https://www.mongodb.org/static/pgp/server-6.0.asc
RUN echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/6.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-6.0.list
RUN apt-get update && \
apt-get install --assume-yes --no-install-recommends --quiet \
python \
...
RUN apt-get install -y mongodb-org
...
But I got next error :
Step 1/14 : FROM php:8.1.6-apache
---> af944036d594
Step 2/14 : RUN curl -fsSL https://www.mongodb.org/static/pgp/server-6.0.asc
---> Using cache
---> 35860e06b960
Step 3/14 : RUN echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/6.0 multiverse" | tee /etc/apt/sources.list.d/mongodb-org-6.0.list
---> Running in 429354b0f0e8
deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/6.0 multiverse
Removing intermediate container 429354b0f0e8
---> 29a893b3932d
Step 4/14 : RUN apt-get update && apt-get install --assume-yes --no-install-recommends --quiet python apt-transport-https libfreetype6-dev libwebp-dev libjpeg62-turbo-dev libpng-dev libzip-dev nano mc git-core libmagickwand-dev curl gnupg2 build-essential libnotify-bin openssl libssl-dev libgmp-dev libldap2-dev netcat locate && git clone https://github.com/nodejs/node.git && cd node && git checkout v14.18.0 && ./configure && make && make install
---> Running in b0e828050374
Get:1 http://security.debian.org/debian-security bullseye-security InRelease [48.4 kB]
Get:2 http://deb.debian.org/debian bullseye InRelease [116 kB]
Ign:3 https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/6.0 InRelease
Get:4 http://security.debian.org/debian-security bullseye-security/main amd64 Packages [218 kB]
Get:5 http://deb.debian.org/debian bullseye-updates InRelease [44.1 kB]
Get:6 http://deb.debian.org/debian bullseye/main amd64 Packages [8183 kB]
Get:7 https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/6.0 Release [3094 B]
Get:8 https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/6.0 Release.gpg [801 B]
Ign:8 https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/6.0 Release.gpg
Get:9 http://deb.debian.org/debian bullseye-updates/main amd64 Packages [14.6 kB]
Reading package lists...
W: GPG error: https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/6.0 Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 6A26B1AE64C3C388
E: The repository 'https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/6.0 Release' is not signed.
ERROR: Service 'web' failed to build: The command '/bin/sh -c apt-get update && apt-get install --assume-yes --no-install-recommends --quiet python apt-transport-https libfreetype6-dev libwebp-dev libjpeg62-turbo-dev libpng-dev libzip-dev nano mc git-core libmagickwand-dev curl gnupg2 build-essential libnotify-bin openssl libssl-dev libgmp-dev libldap2-dev netcat locate && git clone https://github.com/nodejs/node.git && cd node && git checkout v14.18.0 && ./configure && make && make install' returned a non-zero code: 100
What is wrong ?
Thanks in advance!
Try to replace:
git clone https://www.mongodb.org/static/pgp/server-6.0.asc
with
wget -qO - https://www.mongodb.org/static/pgp/server-6.0.asc
or
curl -fsSL https://www.mongodb.org/static/pgp/server-6.0.asc
in you Dockerfile.yml line 17
( usually wget is installed by default in most linux distributions , but if it is not , you may easily install before the line 17 in the apt-get install line , same apply to curl )
PS:
#1 question answer:
wget -qO - https://www.mongodb.org/static/pgp/server-6.0.asc
#2 question answer:
apt-get install apt-transport-https
#3 question answer:
wget -qO - https://www.mongodb.org/static/pgp/server-6.0.asc | sudo apt-key add -

AWS Lambda - Swift Operation not permitted

I am trying to compile Swift code via AWS Lambda.
Therefore I am using an Ubuntu 18.04 Image as base.
The Swift Version is 5.0.1.
When the image is executed locally, it works fine.
When I try to execute it in AWS Lambda, I get the following error:
/usr/bin/ld.gold: fatal error: /tmp/project/src/a.out: Operation not
permitted\nclang-7: error: linker command failed with exit code 1 (use
-v to see invocation)
I think that the problem is caused by the read-only aws lambda container, that only allows to write into the /tmp/ folder.
Do you know how to fix this error? It seems that swift needs permissions for folders, it doesnt have permission for?
Dockerfile
FROM ubuntu:18.04
# install clang
RUN apt-get update
RUN apt-get install -y clang
# install wget
RUN apt-get install -y wget
# install swift dependencies
RUN apt-get install -y libcurl3 libpython2.7 libpython2.7-dev
ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get install -y --no-install-recommends \
binutils \
git \
libc6-dev \
libcurl4 \
libedit2 \
libgcc-5-dev \
libpython2.7 \
libsqlite3-0 \
libstdc++-5-dev \
libxml2 \
pkg-config \
tzdata \
zlib1g-dev \
libbsd-dev
RUN apt-get install -y libicu-dev
# install swift 5.0.1
RUN wget https://swift.org/builds/swift-5.0.1-release/ubuntu1804/swift-5.0.1-RELEASE/swift-5.0.1-RELEASE-ubuntu18.04.tar.gz RUN tar xzf swift-5.0.1-RELEASE-ubuntu18.04.tar.gz RUN mv swift-5.0.1-RELEASE-ubuntu18.04 /usr/lib/swift RUN echo "export PATH=/usr/lib/swift/usr/bin:$PATH" >> ~/.bashrc
RUN . ~/.bashrc
RUN chmod -R o+r /usr/lib/swift
This is the command executed in the AWS-Lambda handler function:
swiftc hello_world.swift -o a.out
hello_world.swift
print("Hello World!")
Your output must be set in tmp folder
swiftc hello_world.swift -o /tmp/a.out

tzdata freeze docker build Swfit image

While run docker build to build a swift image, tzdata will stop the process. It prompt to choose a location, but no reaction after I enter the number .
Configuring tzdata
------------------
Please select the geographic area in which you live. Subsequent configuration
questions will narrow this down by presenting a list of cities, representing
the time zones in which they are located.
1. Africa 4. Australia 7. Atlantic 10. Pacific 13. Etc
2. America 5. Arctic 8. Europe 11. SystemV
3. Antarctica 6. Asia 9. Indian 12. US
Geographic area:
my Dockefile is :
FROM ubuntu:18.04
LABEL maintainer="Swift Infrastructure <swift-infrastructure#swift.org>"
LABEL Description="Docker Container for the Swift programming language"
RUN apt-get update && apt-get upgrade -y && \
apt-get install -y \
git \
curl \
cmake \
wget \
ninja-build \
clang \
python \
uuid-dev \
libicu-dev \
icu-devtools \
libbsd-dev \
libedit-dev \
libxml2-dev \
libsqlite3-dev \
swig \
libpython-dev \
libncurses5-dev \
pkg-config \
libblocksruntime-dev \
libcurl4-openssl-dev \
systemtap-sdt-dev \
tzdata \
rsync && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
# Vapor setup
RUN /bin/bash -c "$(wget -qO- https://apt.vapor.sh)"
# Install vapor and clean
RUN apt-get install swift vapor -y \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
RUN vapor --help
It is work normally before I reset the Docker. Where is my mistake?
Prevent tzdata for asking by adding ARG DEBIAN_FRONTEND=noninteractive to the Dockerfile.

postgresql client - installation on php:5-apache

I work on some old project (Laravel 4.2, php5.6, postgresql) and I wanna to set it up on docker - here is my dockerfile:
FROM php:5-apache
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
RUN apt-get update
RUN apt-get install -y \
git \
nano \
libpng-dev \
libmcrypt-dev \
postgresql-dev \
zlib1g-dev \
zip \
unzip &&\
a2enmod rewrite
RUN docker-php-ext-install pdo &&\
docker-php-ext-install pdo_mysql &&\
docker-php-ext-install pdo_pgsql &&\
docker-php-ext-install zip &&\
docker-php-ext-install gd &&\
docker-php-ext-install pcntl &&\
docker-php-ext-install mcrypt
# COPY php.ini /usr/local/etc/php/php.ini
I get following error:
E: Unable to locate package postgresql-dev
When I change postgresql-dev to postgresql (and change image to FROM php:5-apache-jessie with different combinations: RUN dpkg --configure -a && RUN apt-get -f install && apt-get update && apt-get upgrade -y && apt-get --purge remove postgresql\* I get errors like:
E: Sub-process /usr/bin/dpkg returned an error code (1)
E: Unable to locate package postgresql*
E: Couldn't find any package by glob 'postgresql*'
E: Couldn't find any package by regex 'postgresql*'
You need to install postgresql-server-dev-X.Y for building a server-side extension or libpq-dev for building a client-side application.
You need to install postgresql-server-dev-X.Y for building a server-side extension or libpq-dev for building a client-side application.
configure: error: Cannot find libpq-fe.h. Please specify correct PostgreSQL installation path
Question: How to install postgres php client drivers properly?
In dockerfile change postgresql-dev \ to
libpq-dev \

Docker- docker file to create postgresql Image from postgresql-9.6.1.tar.gz tarball?

How to build postgresql-9.6 image from postgresql-9.6.1.tar.gz using dockerfile?
I tried to create below dockerfile to install postgresql-9.6 on ubuntu. But I am unable to make it a complete image?
FROM ubuntu:16.04
RUN apt-get update && \
apt-get install software-properties-common -y && \
apt-get install wget && \
add-apt-repository "deb http://apt.postgresql.org/pub/repos/apt/ xenial-pgdg main" && \
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - && \
apt-get update && \
apt-get install -y postgresql-9.6 postgresql-client-9.6
EXPOSE 5432
So as an alternative I want to create image from tarball
The official Postgres Dockerfile does a build from source on Debian which should be largely portable to Ubuntu.
It will be easier to just use the postgres:9.6 or postgres:9.6.1 image as a seperate container to your application, rather than trying to manage a build heavy, monolithic container yourself.