mdcms/neuraldb-docs/pages/install-docker.md

86 lines
2 KiB
Markdown

---
title: Docker Install
sort: 100
section-id: installation
keywords: Docker, install, docker run, docker-compose, volumes, container
description: Installing NeuralDB using Docker — single container and docker-compose setups
language: en
---
# Docker Install
Docker is the fastest way to run NeuralDB locally or in a single-server deployment.
## Quick Start
```bash
docker run -d \
--name neuraldb \
-p 5432:5432 \
-e NEURALDB_PASSWORD=mypassword \
-e NEURALDB_DB=mydb \
-v neuraldb_data:/var/lib/neuraldb/data \
neuraldb/neuraldb:latest
```
Connect with psql:
```bash
psql -h localhost -p 5432 -U neuraldb -d mydb
```
## Environment Variables
| Variable | Default | Description |
|----------|---------|-------------|
| `NEURALDB_PASSWORD` | required | Password for the `neuraldb` superuser |
| `NEURALDB_USER` | `neuraldb` | Superuser username |
| `NEURALDB_DB` | `neuraldb` | Default database name |
| `NEURALDB_PORT` | `5432` | TCP port |
| `NEURALDB_SHARED_BUFFERS` | `256MB` | Row store page cache |
| `NEURALDB_VECTOR_BUFFER` | `512MB` | Vector index memory |
## docker-compose Setup
```yaml
version: '3.9'
services:
neuraldb:
image: neuraldb/neuraldb:1.0
container_name: neuraldb
restart: unless-stopped
ports:
- "127.0.0.1:5432:5432"
environment:
NEURALDB_PASSWORD: ${NEURALDB_PASSWORD}
NEURALDB_SHARED_BUFFERS: "4GB"
NEURALDB_VECTOR_BUFFER: "8GB"
volumes:
- neuraldb_data:/var/lib/neuraldb/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U neuraldb"]
interval: 10s
timeout: 5s
retries: 5
volumes:
neuraldb_data:
```
```bash
echo "NEURALDB_PASSWORD=$(openssl rand -base64 32)" > .env
docker-compose up -d
```
## Upgrading
```bash
docker pull neuraldb/neuraldb:1.1
docker stop neuraldb && docker rm neuraldb
docker run -d --name neuraldb \
-v neuraldb_data:/var/lib/neuraldb/data \
-e NEURALDB_PASSWORD=mypassword \
neuraldb/neuraldb:1.1
docker exec neuraldb neuraldb-migrate
```