Skip to content

ramsrib/pgvector

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PgVector Docker Image

This docker image extends the official PostgreSQL image with the PgVector extension.

Supported version of postgres: 12, 13, 14, 15, 16

Installation

For Postgres 16

docker run -d --name pgvector-16 -p 5432:5432 -e POSTGRES_PASSWORD=postgres ramsrib/pgvector:16

# enable the pgvector extension
docker exec -it pgvector-16 psql -U postgres -c "CREATE EXTENSION vector"

# verify the version
docker exec -it pgvector-16 psql -U postgres -c "SELECT extversion FROM pg_extension WHERE extname = 'vector';"

Example commands

docker exec -it pgvector-16 psql -U postgres

CREATE TABLE items (id bigserial PRIMARY KEY, embedding vector(3));
INSERT INTO items (embedding) VALUES ('[1,2,3]'), ('[4,5,6]');
SELECT * FROM items ORDER BY embedding <-> '[3,1,2]' LIMIT 5;

CREATE INDEX ON items USING hnsw (embedding vector_l2_ops);

For Postgres 15

docker run -d --name pgvector-15 -p 5432:5432 -e POSTGRES_PASSWORD=postgres ramsrib/pgvector:15

For Postgres 14

docker run -d --name pgvector-14 -p 5432:5432 -e POSTGRES_PASSWORD=postgres ramsrib/pgvector:14

For Postgres 13

docker run -d --name pgvector-13 -p 5432:5432 -e POSTGRES_PASSWORD=postgres ramsrib/pgvector:13

For Postgres 12

docker run -d --name pgvector-12 -p 5432:5432 -e POSTGRES_PASSWORD=postgres ramsrib/pgvector:12

References