--- slug: /deploy-by-docker --- # Deploy seekdb in a container environment This topic describes how to deploy seekdb through Docker containers. ## Overview The `seekdb` Docker image is available from [dockerhub](https://hub.docker.com/r/oceanbase/seekdb), [quay.io](https://quay.io/repository/oceanbase/seekdb), and [ghcr.io](https://ghcr.io/oceanbase/seekdb), and is designed to help users quickly set up a seekdb environment for testing. :::tip ::: ## Prerequisites Before deploying `seekdb`, ensure that the following requirements are met: * Docker is installed and the Docker service is started. For details, see [Docker documentation](https://docs.docker.com/get-docker/). * Your machine has at least 1 physical core and 2 GB of memory. ## Start a seekdb instance To start a seekdb instance, use the following command: ```shell docker run -d -p 2881:2881 oceanbase/seekdb ``` :::info ::: If you want to execute initialization SQL scripts after startup, you need to mount a directory containing initialization scripts and then specify the mounted directory in the container through the environment variable `INIT_SCRIPTS_PATH`. Example command: ```shell docker run -d -p 2881:2881 -v {init_sql_folder_path}:/root/boot/init.d -e INIT_SCRIPTS_PATH=/root/boot/init.d oceanbase/seekdb ``` In the command, `{init_sql_folder_path}` is the path to the initialization SQL scripts on the host machine. :::tip Do not change the root user password in SQL scripts. If you want to change the root user password, use the environment variable ROOT_PASSWORD, for example: docker run -d -p 2881:2881 -e ROOT_PASSWORD="******" oceanbase/seekdb. ::: The supported environment variables are as follows: | Variable name | Description | Default value | |-----------|--------------------|----------| | ROOT_PASSWORD | Password for the root user. | Empty by default | | CPU_COUNT | Value of cpu_count.| 4 | | MEMORY_LIMIT | Value of memory_limit.| 2G | | LOG_DISK_SIZE | Value of log_disk_size.| 2G | | DATAFILE_SIZE | Value of datafile_size.| 2G | | DATAFILE_NEXT | Value of datafile_next.| 2G | | DATAFILE_MAXSIZE | Value of datafile_maxsize.| 50G | | INIT_SCRIPTS_PATH | Path to initialization scripts in the container.| \ | If you want to modify more seekdb parameters, you can deploy seekdb using a configuration file. You can mount the configuration file to `/etc/oceanbase/seekdb.cnf` in the container. 1. Create a configuration file on the host server. The default configuration file is as follows: ```shell datafile_size=2G datafile_next=2G datafile_maxsize=50G cpu_count=4 memory_limit=8G log_disk_size=2G # config the parameter in the following format # key=value ``` 2. Start seekdb. ```shell docker run -d -p 2881:2881 -v {config_file}:/etc/oceanbase/seekdb.cnf oceanbase/seekdb ``` In the command, `{config_file}` is the path to the configuration file on the host machine. :::tip If you decide to use a configuration file, do not specify resource-related environment variables. ::: ## Data persistence seekdb is deployed in the `/var/lib/oceanbase` directory. If you want to persist data to the host server, mount an empty directory on the host server to this path. ```shell mkdir -p seekdb docker run -d -p 2881:2881 -v $PWD/seekdb:/var/lib/oceanbase --name seekdb oceanbase/seekdb ``` ## Connect to a seekdb instance You can use the OBClient or MySQL client on the host to connect to the seekdb instance. ```shell [admin@test001 ~]$ mysql -uroot -h127.0.0.1 -P2881 -p ``` :::info If the password is not configured through environment variables when starting the seekdb instance, users created in the instance use empty passwords by default. ::: After a successful connection, the terminal displays the following content: ```shell Welcome to the MariaDB monitor. Commands end with ; or \g. Your MySQL connection id is 3221628904 Server version: 5.7.25 OceanBase 4.3.5.3 seekdb (r1.0.0.0) (Built 102025110516-83ac0ad994286047a3e713e82e9541383f6df531 Nov 5 2025) Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. MySQL [(none)]> ``` ## Access the obshell dashboard The container also starts obshell, which provides a user-friendly web interface. If you want to access the obshell dashboard, you can also map the obshell dashboard port. ```shell # 2886 is the port for the obshell dashboard docker run -d -p 2881:2881 -p 2886:2886 oceanbase/seekdb ``` You can access `http://${server_ip}:2886` through a browser. The login password is the same as the root user password. If `ROOT_PASSWORD` is not set, leave the password field empty.