It sounds like PostGIS itself cannot be found in... the PostGIS Docker image. Therefore, I guess I must be wrong somewhere but I cannot figure it out. Here's the error I face each time I build and start a container based on the Dockerfile below:
(...)
app_1 | /usr/local/bin/docker-entrypoint.sh: sourcing /docker-entrypoint-initdb.d/10_postgis.sh
app_1 | CREATE DATABASE
app_1 | Loading PostGIS extensions into template_postgis
app_1 | 2021-02-20 00:09:20.414 CET [91] ERROR: could not access file "$libdir/postgis-3": No such file or directory
app_1 | 2021-02-20 00:09:20.414 CET [91] STATEMENT: CREATE EXTENSION IF NOT EXISTS postgis;
app_1 | ERROR: could not access file "$libdir/postgis-3": No such file or directory
And here's the Dockerfile generating this error:
FROM postgis/postgis:13-3.1
ENV POSTGRES_DB=somedb
ENV POSTGRES_USER=someuser
ENV POSTGRES_PASSWORD=****
# Dont know why but I have to set these otherwise I got the error:
# initdb: error: invalid locale settings; check LANG and LC_* environment variables
ENV LC_ALL="C.UTF-8"
ENV LC_CTYPE="C.UTF-8"
RUN set -eux \
&& apt-get update \
&& apt-get install -y wget unzip openjdk-11-jdk
&& echo deb 'http://deb.debian.org/debian testing main' >> /etc/apt/sources.list \
&& apt-get update \
&& export DEBIAN_FRONTEND=noninteractive \
&& apt-get install -y --fix-missing --no-install-recommends tzdata \
proj-bin gdal-bin libproj-dev proj-data libgeos-dev libgdal-dev \
&& apt-get -y autoremove --purge && apt-get -y autoclean
I went there; PostgreSQL 12 and PostGIS 3.0.1: ERROR: could not access file "$libdir/postgis-3": No such file or directory on Linux but I really don't know why the heck I should install PostGIS as proposed inside an image which is supposed to be PostGIS-ready...
Does anybody have any hint on what's going on and how to fix it?
Related
When using database_name.my_schema on a remote database it tells me that db does not exists, but if I use only the database_name it seems to connect, but when I run
RUN php bin/console doctrine:migrations:migrate --no-interaction
on Dockerfile it fails to connect.
On /config/packages/doctrine.yaml
doctrine:
dbal:
dbname : 'my_db' // or dbname.myschema
user : 'user'
password : 'xxxxxxxx'
host : 'xxxxxxxx'
port: 1520
driver : 'pdo_pgsql'
server_version: '13'
The Dockerfile
FROM php:8.1-apache AS symfony_php
RUN a2enmod rewrite
RUN apt-get update \
&& apt-get install -y libpq-dev libzip-dev git libxml2-dev wget --no-install-recommends \
&& docker-php-ext-configure pgsql -with-pgsql=/usr/local/pgsql \
&& docker-php-ext-install pdo pdo_pgsql pgsql zip \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
RUN wget https://getcomposer.org/download/2.3.5/composer.phar \
&& mv composer.phar /usr/bin/composer && chmod +x /usr/bin/composer
COPY docker/php/apache.conf /etc/apache2/sites-enabled/000-default.conf
COPY docker/php/php.ini /usr/local/etc/php/conf.d/app.ini
COPY . /var/www
WORKDIR /var/www
RUN composer install
RUN php bin/console doctrine:migrations:migrate --no-interaction
RUN mkdir ./var/cache/pfv && mkdir ./var/log/pfv && chmod -R 777 ./var/cache && chmod -R 777 ./var/lo
So, the questions are what is the correct setup for postgres with custom schema and why when apparently it connects with just de database name, the migration command fails.
EDIT
Error thrown:
[critical] Error thrown while running command "doctrine:migrations:migrate --no-interaction". Message: "An exception occurred in the driver: SQLSTATE[08006] [7] timeout expired"
In ExceptionConverter.php line 81:
An exception occurred in the driver: SQLSTATE[08006] [7] timeout expired
I need the mongo shell installed inside the ansible-operator image.
My first attempt was to use this Dockerfile:
FROM mongo:4.2.9
FROM quay.io/operator-framework/ansible-operator:v1.0.0
COPY --from=0 /usr/bin/mongo /usr/bin/mongo
COPY requirements.yml ${HOME}/requirements.yml
RUN ansible-galaxy collection install -r ${HOME}/requirements.yml \
&& chmod -R ug+rwx ${HOME}/.ansible
COPY watches.yaml ${HOME}/watches.yaml
COPY roles/ ${HOME}/roles/
COPY playbooks/ ${HOME}/playbooks/
Unsurprisingly, this didn't worked.
"stderr_lines": ["/usr/bin/mongo: /lib64/libcurl.so.4: no version information available (required by /usr/bin/mongo)", "Failed global initialization: InvalidSSLConfiguration Can not set up PEM key file."]
Can anyone help me?
I finally figured it out...
Just add this to your Dockerfile.
(mongodb-org-4.2.repo)
USER 0
COPY mongodb-org-4.2.repo /etc/yum.repos.d/mongodb-org-4.2.repo
RUN yum -y update \
&& yum install -y mongodb-org-shell \
&& yum clean all \
&& rm -rf /var/cache/yum
RUN rm /etc/yum.repos.d/mongodb-org-4.2.repo
USER ${USER_UID}
I has 128-dimensional vectors of float (face recognition issue). To store these vectors I use datatype cube in Postgresql.
This type has limit by default - 100 dim.
In the psql (PostgreSQL) 10.5 (Ubuntu 10.6-0ubuntu0.18.04.1) this limit don't work: I can store my vector without any problems.
But yeasterday one of my machine was updated to PostgreSQL 10.6 and now I receive an error when try to add new cube-vector into my database. Error about too long vector.
To resolve this problem I have to change this limit in the file cubedata.h which is in contrib directory. But I have no this file and such directory at all!
I try install
sudo apt-get install postgresql-contrib
but, I get the message about the newest postgresql-contrib version is already installed.
After I tried to manually download cubedata.h file into the directory of Postgresql (/usr/share/postgresql/10/extension/), but it doesn't help.
My be someone encountered with such problem?
In Ubuntu 18.04.1 cubedata.h included in the postgres-server-dev-10 package from the PostgreSQL official repository. But prebuilt cube.so included in the postgresql-10 package with default limit.
To increase the limit you should recompile cube.so from source. Below the example of code for the Ubuntu.
Add repository:
PG_VER=10.6
source /etc/os-release
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
echo "deb http://apt.postgresql.org/pub/repos/apt/ ${VERSION_CODENAME}-pgdg main" | sudo tee /etc/apt/sources.list.d/pgdg.list
sudo apt-get update
sudo apt-get install -y postgresql-${PG_VER%.*}
Compile cube extension from source:
PG_VER=10.6
sudo apt-get install -y unzip gcc make zlib1g-dev libreadline-dev postgresql-server-dev-${PG_VER%.*} bison flex
wget https://ftp.postgresql.org/pub/source/v${PG_VER}/postgresql-${PG_VER}.tar.bz2 --quiet -O postgresql.tar.bz2
tar xvf postgresql.tar.bz2
cd postgresql-${PG_VER}
./configure
cd contrib/cube
sed -i 's/#define CUBE_MAX_DIM (100)/#define CUBE_MAX_DIM (128)/' cubedata.h
make USE_PGXS=1
sudo make USE_PGXS=1 install
Check result after restart server:
sudo -u postgres psql dbname -c 'CREATE EXTENSION cube'
sudo -u postgres psql dbname -c 'SELECT cube_dim(cube(array(select generate_series(1, 128)))) as dim'
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 \
I am new at Codenvy so my question can be very stupid, by the way this is my problem:
I created my project then to add the DB (postgresql) i created a new docker file and i pasted in it the code in this file: https://github.com/codenvy/dockerfiles/blob/master/base/jdk7_postgresql/Dockerfile
I saved it then i ran the project with the runner just created, but i have this error:
[DOCKER] Setting up dh-python (1.20141111-2) ...
[DOCKER] Processing triggers for systemd (215-17+deb8u2) ...
[DOCKER] Processing triggers for libc-bin (2.19-18+deb8u1) ...
[DOCKER] Processing triggers for dbus (1.8.20-0+deb8u1) ...
[DOCKER] Starting PostgreSQL 9.3 database server:
[DOCKER] main
[DOCKER] .
[DOCKER] CREATE ROLE
[DOCKER] ---> 77b708d3360b
[DOCKER] Removing intermediate container cdd908fb498e
[DOCKER] Step 4 : ADD startup.sh /home/user/startup.sh
[DOCKER][ERROR] startup.sh: no such file or directory
[ERROR] We are having trouble starting the runner and deploying application. Either necessary files are missing or a fundamental configuration has changed.
Docker image build failed
Any idea to how can i solve the problem?
thanks in advance!
This PostgresSQL image uses startup.sh script to start postgresql service. You can find it at https://github.com/codenvy/dockerfiles/blob/master/base/jdk7_postgresql/startup.sh
To solve this problem you can either create a new file startup.sh with an identical content in the root of your project, add it as a source (e.g. ADD $src$/startup.sh /home/user/startup.sh). You will also need to inject project sources to make it work as expected, so as a result your Dockerfile may look like this:
FROM codenvy/jdk7
ENV DEBIAN_FRONTEND noninteractive
RUN sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys B97B0AFCAA1A47F044F244A07FCC7D46ACCC4CF8 && \
echo "deb http://apt.postgresql.org/pub/repos/apt/ precise-pgdg main" | sudo tee /etc/apt/sources.list.d/pgdg.list && \
sudo apt-get update && \
sudo -E bash -c "apt-get install -y python-software-properties software-properties-common postgresql-9.3 postgresql-client-9.3 postgresql-contrib-9.3 pwgen" && \
sudo service postgresql start && \
CODENVY_POSTGRESQL_PASSWORD=$(pwgen -N 1) && echo "export CODENVY_POSTGRESQL_PASSWORD=$CODENVY_POSTGRESQL_PASSWORD" >> /home/user/.postgresrc && \
CODENVY_POSTGRESQL_DB=testdb_$(pwgen -N 1) && echo "export CODENVY_POSTGRESQL_DB=$CODENVY_POSTGRESQL_DB" >> /home/user/.postgresrc && \
CODENVY_POSTGRESQL_USER=codenvy && echo "export CODENVY_POSTGRESQL_USER=$CODENVY_POSTGRESQL_USER" >> /home/user/.postgresrc && \
sudo -u postgres psql --command "CREATE USER $CODENVY_POSTGRESQL_USER WITH SUPERUSER PASSWORD '$CODENVY_POSTGRESQL_PASSWORD';" && \
sudo -u postgres createdb -O $CODENVY_POSTGRESQL_USER $CODENVY_POSTGRESQL_DB
#Inject project sources
ADD $app$ /home/user/$app$
RUN unzip -q /home/user/$app$ -d /home/user
ENV ARGUMENTS $args$
#Add file to the container
ADD $src$/startup.sh /home/user/startup.sh
RUN sudo chmod +x /home/user/startup.sh
#EXPOSE 5432
CMD sudo /home/user/startup.sh
Or you can simply use Codenvy default PostgreSQL 9.3 + Java 7 runner, which you will find on the Runners panel > Configs tab.