简体   繁体   中英

ignoring /docker-entrypoint-initdb.d error for Postgres database in a configuration that previously worked

I have been battling with this issue for a few days now and I'm stumped. It's probably something simple I've overlooked.

I have a docker-project written using docker-compose. The file is here docker-compose.yml

version: '3'

services:
  vdb:
    build:
      context: .
      dockerfile: vdb_docker.df
    ports:
      - "33060:3306"
    expose:
      - "33060"
  vvta:
    build:
      context: .
      dockerfile: vvta_docker.df
    ports:
      - "54320:5432"
    expose:
      - "54320"
  seqrepo:
    build:
      context: .
      dockerfile: vvsr_docker.df
    volumes:
      - seqdata:/usr/local/share/seqrepo
  vv:
    build: .
    depends_on:
      - vdb
      - vvta
    volumes:
      - seqdata:/usr/local/share/seqrepo
      - share:/usr/local/share

volumes:
  share:
    driver: local
    driver_opts:
      type: 'none'
      o: 'bind'
      device: '${HOME}/variantvalidator_data/share'
  seqdata:
    driver: local
    driver_opts:
      type: 'none'
      o: 'bind'
      device: '${HOME}/variantvalidator_data/share/seqrepo'

The build process imports severaldockerfiles but the relevant one is vvta_docker.df

FROM postgres:latest

ENV POSTGRES_DB=vvta

ENV POSTGRES_USER=vvta_admin

ENV POSTGRES_PASSWORD=vvta_admin

RUN apt-get update && apt-get install -y wget && rm -rf /var/lib/apt/lists/*

RUN wget https://www528.lamp.le.ac.uk/vvdata/vvta/VVTA_2021_2_noseq.psql.gz -O /docker-entrypoint-initdb.d/VVTA_2021_2_noseq.psql.gz

This configuration worked fine for a previous build of the database. Note, the address for the database is contained in the vvta_docker.df file if needed. The build process is (in-draft) documented in DOCKER.md and I always "prune" all containers while building test releases.

- Pull images

```bash
$ docker-compose pull
  • Create a directory for sharing resources between your computer and the container
$ mkdir ~/variantvalidator_data
$ mkdir ~/variantvalidator_data/share

ie a directory called share in your home directory

  • Build
$ docker-compose build --no-cache
  • Complete build
    • The first time you do this, it will complete the build process, for example, populating the required the databases
    • When this is completed you will need to shutdown the services and re-start (see below)
$ docker-compose up
  • Shutdown services when you want to stop the container
ctrl + c

However, I keep getting an error /usr/local/bin/docker-entrypoint.sh: ignoring /docker-entrypoint-initdb.d/VVTA_2021_2_noseq.psql.gz . I will attach the full (relevant) trace below

I hope it's OK to use links. It's more understandable to me and hopefully easier for you all.

Things I've tried Increasing the docker partition space and memory and cores Alternate configurations eg This one I have found relatively similar items on Stack Overflow, but not quite sure how relevant they are

Docker build trace

vvta_1     | ok
vvta_1     | syncing data to disk ... ok
vvta_1     | 
vvta_1     | 
vvta_1     | Success. You can now start the database server using:
vvta_1     | 
vvta_1     |     pg_ctl -D /var/lib/postgresql/data -l logfile start
vvta_1     | 
vvta_1     | initdb: warning: enabling "trust" authentication for local connections
vvta_1     | You can change this by editing pg_hba.conf or using the option -A, or
vvta_1     | --auth-local and --auth-host, the next time you run initdb.
vvta_1     | waiting for server to start....2021-07-23 13:09:52.135 UTC [47] LOG:  starting PostgreSQL 12.6 (Debian 12.6-1.pgdg100+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 8.3.0-6) 8.3.0, 64-bit
vvta_1     | 2021-07-23 13:09:52.137 UTC [47] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
vvta_1     | 2021-07-23 13:09:52.193 UTC [48] LOG:  database system was shut down at 2021-07-23 13:09:51 UTC
vvta_1     | 2021-07-23 13:09:52.205 UTC [47] LOG:  database system is ready to accept connections
vvta_1     |  done
vvta_1     | server started
vvta_1     | CREATE DATABASE
vvta_1     | 
vvta_1     | 
vvta_1     | /usr/local/bin/docker-entrypoint.sh: ignoring /docker-entrypoint-initdb.d/VVTA_2021_2_noseq.psql.gz
vvta_1     | 
vvta_1     | waiting for server to shut down...2021-07-23 13:09:52.603 UTC [47] LOG:  received fast shutdown request
vvta_1     | .2021-07-23 13:09:52.604 UTC [47] LOG:  aborting any active transactions
vvta_1     | 2021-07-23 13:09:52.614 UTC [47] LOG:  background worker "logical replication launcher" (PID 54) exited with exit code 1
vvta_1     | 2021-07-23 13:09:52.615 UTC [49] LOG:  shutting down
vvta_1     | 2021-07-23 13:09:52.648 UTC [47] LOG:  database system is shut down
vvta_1     |  done
vvta_1     | server stopped
vvta_1     | 
vvta_1     | PostgreSQL init process complete; ready for start up.
vvta_1     | 
vvta_1     | 2021-07-23 13:09:52.722 UTC [1] LOG:  starting PostgreSQL 12.6 (Debian 12.6-1.pgdg100+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 8.3.0-6) 8.3.0, 64-bit
vvta_1     | 2021-07-23 13:09:52.730 UTC [1] LOG:  listening on IPv4 address "0.0.0.0", port 5432
vvta_1     | 2021-07-23 13:09:52.730 UTC [1] LOG:  listening on IPv6 address "::", port 5432
vvta_1     | 2021-07-23 13:09:52.735 UTC [1] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
vvta_1     | 2021-07-23 13:09:52.758 UTC [75] LOG:  database system was shut down at 2021-07-23 13:09:52 UTC
vvta_1     | 2021-07-23 13:09:52.768 UTC [1] LOG:  database system is ready to accept connections

The Docker Hub postgres image page notes:

If you would like to do additional initialization in an image derived from this one, add one or more *.sql , *.sql.gz , or *.sh scripts under /docker-entrypoint-initdb.d ....

The file you have doesn't match one of these three patterns, though, its filename ends with .psql.gz . You need to rename it when you download it:

RUN wget https://www528.lamp.le.ac.uk/vvdata/vvta/VVTA_2021_2_noseq.psql.gz \
  -O /docker-entrypoint-initdb.d/VVTA_2021_2_noseq.sql.gz
# change this filename to remove "p" here ........ ^^^

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM