Running YDB in Docker

Before start

Create a folder for testing YDB and use it as the current working directory:

mkdir ~/ydbd && cd ~/ydbd
mkdir ydb_data
mkdir ydb_certs

Launching a container with YDB in Docker

Example of the YDB startup command in Docker with detailed comments:

docker run \
    -d \ # run container in background and print container ID
    --rm \ # automatically remove the container
    --name ydb-local \ # assign a name to the container
    -h localhost \ # hostname
    -p 2135:2135 \ # publish a container grpcs port to the host 
    -p 2136:2136 \ # publish a container grpc port to the host 
    -p 8765:8765 \ # publish a container http port to the host 
    -p 5432:5432 \ # publish a container port to the host that provides PostgreSQL compatibility
    -p 9092:9092 \ # publish a container port to the host that provides Kafka compatibility
    -v $(pwd)/ydb_certs:/ydb_certs \ # mount directory with TLS certificates
    -v $(pwd)/ydb_data:/ydb_data \ # mount working directory
    -e GRPC_TLS_PORT=2135 \ # grpcs port, needs to match what's published above
    -e GRPC_PORT=2136 \ # grpc port, needs to match what's published above
    -e MON_PORT=8765 \ # http port, needs to match what's published above
    -e YDB_KAFKA_PROXY_PORT=9092 \ # port, needs to match what's published above
    ydbplatform/local-ydb:latest # docker image name and tag

Note

If you are using a Mac with an Apple Silicon processor, emulate the x86_64 CPU instruction set with Rosetta:

  • colima with the colima start --arch aarch64 --vm-type=vz --vz-rosetta options.
  • Docker Desktop with installed and enabled Rosetta 2.

For more information about environment variables available when running a Docker container with YDB, see Configuring the YDB Docker container.

With the parameters specified in the example above and running Docker locally, Embedded UI will be available at http://localhost:8765.

For more information about stopping and deleting a Docker container with YDB, see Docker stop.