Thread

  1. building a singularity image from docker hub postgres image

    Allan Kamau <kamauallan@gmail.com> — 2024-01-30T05:52:19Z

    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?
    
    -Allan.
    
  2. Re: building a singularity image from docker hub postgres image

    Justin Clift <justin@postgresql.org> — 2024-01-30T09:27:19Z

    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
    
    
    
    
  3. Re: building a singularity image from docker hub postgres image

    Allan Kamau <kamauallan@gmail.com> — 2024-02-01T10:50:20Z

    On Tue, Jan 30, 2024 at 12:27 PM Justin Clift <justin@postgresql.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@somehostname:5423/some_db_name"
    \
                    "-c" \
                    "SELECT version();" \
        ;date;
    };date;
    
    
    Allan.