Re: building a singularity image from docker hub postgres image

From: Allan Kamau <kamauallan(at)gmail(dot)com>
To: Justin Clift <justin(at)postgresql(dot)org>
Cc: Postgres General Postgres General <pgsql-general(at)postgresql(dot)org>
Subject: Re: building a singularity image from docker hub postgres image
Date: 2024-02-01 10:50:20
Message-ID: CAF3N6oQaEqAqpGuzmmcTsQDZ4qm-Na2J_Lb97kaFiZ-TLDLKkA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, Jan 30, 2024 at 12:27 PM Justin Clift <justin(at)postgresql(dot)org> wrote:

> On 2024-01-30 15:52, Allan Kamau wrote:
> > I am trying to build a singularity image from postgres docker image.
> > I am issuing the command below.
> >
> > $ singularity build /local/data/some/postgres.16.1.sif
> > docker://postgres/postgres:16.1
> >
> > INFO: Starting build...
> > INFO: Fetching OCI image...
> > FATAL: While performing build: conveyor failed to get: GET
> > https://index.docker.io/v2/postgres/postgres/manifests/16.1:
> > UNAUTHORIZED:
> > authentication required; [map[Action:pull Class: Name:postgres/postgres
> > Type:repository]]
> >
> > What is the url I should use?
>
> Not personally familiar with Singularity, but this post looks like it
> should help:
>
>
> https://www.linuxwave.info/2022/04/running-postgresql-database-using.html
>
> The example command they have there is:
>
> singularity pull docker://postgres:14.2-alpine3.15
>
> So the format of the url *seems* like it should be:
>
> docker://postgres:16.1
>
> That just pure guess work though. :)
>
> Regards and best wishes,
>
> Justin Clift
>

Thanks Justin for the corrections and resources.
I have now put together the command below that does what I was looking for.

$ cd /tmp/;singularity pull postgres_16.1-alpine3.19.sif
docker://postgres:16.1-alpine3.19;

I am using the singularity container for the postgresql binaries instead
of having to install the binaries on the computer. For example I am using
pg_dump to take backups.

This could be of help to others, below is an example of using the
PostgreSQL binaries in the singularity image built from PostgreSQL docker
image.

##construct the singularity image
singularity_image_dfn="/local/data/bcl-sdv/singularity/pg";
mkdir -p "${singularity_image_dfn}";
date;time singularity build
"${singularity_image_dfn}"/postgres.16.1-alpine3.19.sif
docker://postgres/postgres:16.1-alpine3.19;date;

##Example usage of the singularity image
date;time {

singularity_image_fn="/local/data/bcl-sdv/singularity/pg/postgres_16.1-alpine3.19.sif";
date;time singularity exec \
--workdir /tmp \
"${singularity_image_fn}" \
"psql" \

"postgresql://someusername:somepassword(at)somehostname:5423/some_db_name"
\
"-c" \
"SELECT version();" \
;date;
};date;

Allan.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Evan Czaplicki 2024-02-01 12:46:18 using palloc/pfree for OpenSSL allocations with CRYPTO_set_mem_functions
Previous Message Marius Lorek 2024-02-01 09:22:35 TableOID in description of inlined function