Error on initializing postgres-postgis image

When initializing docker image circleci/postgres:9-alpine-postgis , I got an error and not work.

/usr/local/bin/docker-entrypoint.sh: running /docker-entrypoint-initdb.d/postgis.sh
/docker-entrypoint-initdb.d/postgis.sh: line 10: syntax error: bad substitution
LOG:  received SIGHUP, reloading configuration files
LOG:  parameter "listen_addresses" cannot be changed without restarting the server
LOG:  configuration file "/var/lib/postgresql/data/postgresql.conf" contains errors; unaffected changes were applied

Exited with code 2
1 Like

The same problem with circleci/postgres:9.6-postgis

@m2wasabi, @dlancer:

Readers would need to see how you are creating this container. What do you have in your docker key in your YAML config? I wonder if you are using a command and it is causing a problem with the entrypoint.

This error can occur simply below command.

docker run -it circleci/postgres:9.6.9-alpine-postgis

Right, are you not running it in CircleCI using the docker key?

You can use docker run yourself, but I expect that you need to inject in some parameters, and the default entrypoint may well fall over if those params are not provided. Take a look on GitHub for the postgis.sh to see what it needs.

It may also just be worthwhile to see if there is some documentation on this image. I have not used it, but I imagine it might want a hostname/IP to listen on, and a default username/password of a root user?

Yes, I use docker key in CircleCI.

I read this document and write config.
https://circleci.com/docs/2.0/postgres-config/

My .circleci/config.yml tree is below

jobs:
  test:
    docker:
      - image: circleci/openjdk:8-jdk-node-browsers
        environment:
...
      - image: circleci/postgres:9-alpine-postgis
        environment:
        - POSTGRES_USER: root
        - POSTGRES_DB: circle-test_test
    steps:
...

Is it need to set configure password ?

F.Y.R. circleci/postgres:9.6.8-alpine-postgis works fine. I use it temporary.

1 Like

We use this in our config and it works without a problem until latest ci images update:

docker:
  - image: circleci/postgres:9.6-postgis
    environment:
      POSTGRES_USER: user
      POSTGRES_PASSWORD: password
      POSTGRES_DB: db_name

Same here. example:

waiting for server to start....LOG:  database system was shut down at 2018-06-10 13:53:24 UTC
LOG:  MultiXact member wraparound protections are now enabled
LOG:  database system is ready to accept connections
LOG:  autovacuum launcher started
FATAL:  role "root" does not exist
 done
server started
CREATE DATABASE

CREATE ROLE


/usr/local/bin/docker-entrypoint.sh: running /docker-entrypoint-initdb.d/postgis.sh
/docker-entrypoint-initdb.d/postgis.sh: line 10: syntax error: bad substitution
LOG:  received SIGHUP, reloading configuration files
LOG:  parameter "listen_addresses" cannot be changed without restarting the server
LOG:  configuration file "/var/lib/postgresql/data/postgresql.conf" contains errors; unaffected changes were applied

YAML config:

version: 2
jobs:
  build:
    docker:
      - image: circleci/postgres:9.6-alpine-postgis
        environment:
        - POSTGRES_USER: root
        - POSTGRES_DB: thedatabase

Here is what the logs say when it works:

waiting for server to start....LOG:  database system was shut down at 2018-06-09 16:16:30 UTC
LOG:  MultiXact member wraparound protections are now enabled
LOG:  database system is ready to accept connections
LOG:  autovacuum launcher started
FATAL:  role "root" does not exist
 done
server started
CREATE DATABASE

CREATE ROLE


/usr/local/bin/docker-entrypoint.sh: running /docker-entrypoint-initdb.d/postgis.sh
CREATE DATABASE
UPDATE 1
Loading PostGIS extensions into template_postgis
CREATE EXTENSION
CREATE EXTENSION
CREATE EXTENSION
CREATE EXTENSION
Loading PostGIS extensions into thedatabase
CREATE EXTENSION
CREATE EXTENSION
CREATE EXTENSION
CREATE EXTENSION

waiting for server to shut down...LOG:  received fast shutdown request
.LOG:  aborting any active transactions
LOG:  autovacuum launcher shutting down
LOG:  shutting down
LOG:  database system is shut down
 done
server stopped

PostgreSQL init process complete; ready for start up.

LOG:  database system was shut down at 2018-06-09 16:16:35 UTC
LOG:  MultiXact member wraparound protections are now enabled
LOG:  database system is ready to accept connections
LOG:  autovacuum launcher started

I wonder if there is a breaking change in postgis.sh? I expect this is on GitHub, so you could do a custom fix initially, running from your own Docker registry, and then if that works, raise a PR for CircleCI folks to merge in for the next version.

Something definitely broke between Friday and today. There was a new push of images sometime at the end of last week that introduced the problem. See also this issue reported on GitHub for the images repo.

I worked around the issue in the meantime by using 10.3-postgis-ram instead of 10-postgis-ram (which points to 10.4) - it seems the issue only exists in the “latest” for each major version

I also opened a ticket with CircleCI since these are their convenience images

2 Likes

The is an issue with the PostGIS variant images that was caused due to an upstream change with the PostgreSQL image. A possible fix has been merged and new images should be produced soon. I’ll follow up.

Newer images were pushed. This issue is resolved.