Question

Deploying the pgvector docker image fails

Whenever I attempt to deploy the pgvector/pgvector:pg16 docker image, it fails to start. This does not happen when I deploy this in other environments- including locally using docker-compose.

Some info on pgvector docker image: https://github.com/pgvector/pgvector?tab=readme-ov-file#docker

Other things to note:

  • Deploy logs for the image contain only a single entry:
    • [2024-03-16 08:14:25] ls: cannot access '/docker-entrypoint-initdb.d/': Invalid argument
  • Setting up a script (creating an image from the pgvector/pgvector:pg16 image with my own Dockerfile) to run a loop using pg_isready just spins forever, always returning false.

Any help would be appreciated… here is the relevant part of my app spec:

services:
- internal_ports:
  - 5432
  image:
    registry: pgvector
    registry_type: DOCKER_HUB
    repository: pgvector
    tag: pg16
  instance_count: 1
  instance_size_slug: professional-s
  name: pgvector

Hopefully someone else knows what’s going on here, and can help me out!


Submit an answer


This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Bobby Iliev
Site Moderator
Site Moderator badge
March 17, 2024

Hey!

I just tried deploying that Docker image and it seems to be working as expected as long as I set the POSTGRES_PASSWORD env variable:

[pgvector-pgvector] [2024-03-17 16:36:59] The files belonging to this database system will be owned by user "postgres".
[pgvector-pgvector] [2024-03-17 16:36:59] This user must also own the server process.
[pgvector-pgvector] [2024-03-17 16:36:59] 
[pgvector-pgvector] [2024-03-17 16:36:59] The database cluster will be initialized with locale "en_US.utf8".
[pgvector-pgvector] [2024-03-17 16:36:59] The default database encoding has accordingly been set to "UTF8".
[pgvector-pgvector] [2024-03-17 16:36:59] The default text search configuration will be set to "english".
[pgvector-pgvector] [2024-03-17 16:36:59] 
[pgvector-pgvector] [2024-03-17 16:36:59] Data page checksums are disabled.
[pgvector-pgvector] [2024-03-17 16:36:59] 
[pgvector-pgvector] [2024-03-17 16:36:59] fixing permissions on existing directory /var/lib/postgresql/data ... ok
[pgvector-pgvector] [2024-03-17 16:36:59] creating subdirectories ... ok
[pgvector-pgvector] [2024-03-17 16:36:59] selecting dynamic shared memory implementation ... posix
[pgvector-pgvector] [2024-03-17 16:36:59] selecting default max_connections ... 100
[pgvector-pgvector] [2024-03-17 16:36:59] selecting default shared_buffers ... 128MB
[pgvector-pgvector] [2024-03-17 16:36:59] selecting default time zone ... Etc/UTC
[pgvector-pgvector] [2024-03-17 16:36:59] creating configuration files ... ok
[pgvector-pgvector] [2024-03-17 16:37:00] running bootstrap script ... ok
[pgvector-pgvector] [2024-03-17 16:37:02] performing post-bootstrap initialization ... ok
[pgvector-pgvector] [2024-03-17 16:37:02] syncing data to disk ... ok
[pgvector-pgvector] [2024-03-17 16:37:02] 
[pgvector-pgvector] [2024-03-17 16:37:02] initdb: warning: enabling "trust" authentication for local connections
[pgvector-pgvector] [2024-03-17 16:37:02] initdb: hint: You can change this by editing pg_hba.conf or using the option -A, or --auth-local and --auth-host, the next time you run initdb.
[pgvector-pgvector] [2024-03-17 16:37:02] 
[pgvector-pgvector] [2024-03-17 16:37:02] Success. You can now start the database server using:
[pgvector-pgvector] [2024-03-17 16:37:02] 
[pgvector-pgvector] [2024-03-17 16:37:02]     pg_ctl -D /var/lib/postgresql/data -l logfile start
[pgvector-pgvector] [2024-03-17 16:37:02] 
[pgvector-pgvector] [2024-03-17 16:37:03] waiting for server to start....2024-03-17 16:37:03.062 UTC [42] LOG:  starting PostgreSQL 16.2 (Debian 16.2-1.pgdg120+2) on x86_64-pc-linux-gnu, compiled by gcc (Debian 12.2.0-14) 12.2.0, 64-bit
[pgvector-pgvector] [2024-03-17 16:37:03] 2024-03-17 16:37:03.065 UTC [42] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
[pgvector-pgvector] [2024-03-17 16:37:03] 2024-03-17 16:37:03.126 UTC [45] LOG:  database system was shut down at 2024-03-17 16:37:02 UTC
[pgvector-pgvector] [2024-03-17 16:37:03] 2024-03-17 16:37:03.170 UTC [42] LOG:  database system is ready to accept connections
[pgvector-pgvector] [2024-03-17 16:37:03]  done
[pgvector-pgvector] [2024-03-17 16:37:03] server started
[pgvector-pgvector] [2024-03-17 16:37:03] 
[pgvector-pgvector] [2024-03-17 16:37:03] /usr/local/bin/docker-entrypoint.sh: ignoring /docker-entrypoint-initdb.d/*
[pgvector-pgvector] [2024-03-17 16:37:03] 
[pgvector-pgvector] [2024-03-17 16:37:03] waiting for server to shut down...2024-03-17 16:37:03.471 UTC [42] LOG:  received fast shutdown request
[pgvector-pgvector] [2024-03-17 16:37:03] .2024-03-17 16:37:03.473 UTC [42] LOG:  aborting any active transactions
[pgvector-pgvector] [2024-03-17 16:37:03] 2024-03-17 16:37:03.644 UTC [42] LOG:  background worker "logical replication launcher" (PID 48) exited with exit code 1
[pgvector-pgvector] [2024-03-17 16:37:03] 2024-03-17 16:37:03.649 UTC [43] LOG:  shutting down
[pgvector-pgvector] [2024-03-17 16:37:03] 2024-03-17 16:37:03.651 UTC [43] LOG:  checkpoint starting: shutdown immediate
[pgvector-pgvector] [2024-03-17 16:37:03] 2024-03-17 16:37:03.661 UTC [43] LOG:  checkpoint complete: wrote 3 buffers (0.0%); 0 WAL file(s) added, 0 removed, 0 recycled; write=0.003 s, sync=0.001 s, total=0.012 s; sync files=2, longest=0.001 s, average=0.001 s; distance=0 kB, estimate=0 kB; lsn=0/14EAA70, redo lsn=0/14EAA70
[pgvector-pgvector] [2024-03-17 16:37:03] 2024-03-17 16:37:03.733 UTC [42] LOG:  database system is shut down
[pgvector-pgvector] [2024-03-17 16:37:03]  done
[pgvector-pgvector] [2024-03-17 16:37:03] server stopped
[pgvector-pgvector] [2024-03-17 16:37:03] 
[pgvector-pgvector] [2024-03-17 16:37:03] PostgreSQL init process complete; ready for start up.
[pgvector-pgvector] [2024-03-17 16:37:03] 
[pgvector-pgvector] [2024-03-17 16:37:03] 2024-03-17 16:37:03.944 UTC [1] LOG:  starting PostgreSQL 16.2 (Debian 16.2-1.pgdg120+2) on x86_64-pc-linux-gnu, compiled by gcc (Debian 12.2.0-14) 12.2.0, 64-bit
[pgvector-pgvector] [2024-03-17 16:37:03] 2024-03-17 16:37:03.947 UTC [1] LOG:  listening on IPv4 address "0.0.0.0", port 5432
[pgvector-pgvector] [2024-03-17 16:37:03] 2024-03-17 16:37:03.947 UTC [1] LOG:  listening on IPv6 address "::", port 5432
[pgvector-pgvector] [2024-03-17 16:37:03] 2024-03-17 16:37:03.949 UTC [1] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
[pgvector-pgvector] [2024-03-17 16:37:03] 2024-03-17 16:37:03.975 UTC [56] LOG:  database system was shut down at 2024-03-17 16:37:03 UTC
[pgvector-pgvector] [2024-03-17 16:37:04] 2024-03-17 16:37:04.060 UTC [1] LOG:  database system is ready to accept connections

Can you confirm if you’ve setup all of the required env variables by the pgvector Docker image?

Best,

Bobby

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Featured on Community

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
DigitalOcean Cloud Control Panel