Get started with QuestDB via Docker
QuestDB has images for both Linux/macOS and Windows on Docker Hub.
#
Install DockerBefore we start, you will need to install Docker. You can find guides for your platform on the official documentation.
#
QuestDB imageOnce Docker is installed, you will need to pull QuestDB's image from
Docker Hub and create a container. You can do both in one
command using docker run
:
#
OptionsArgument | Description |
---|---|
-p | Port to publish to the host |
-v | To bind mount a volume. |
-p
parameter#
This parameter will publish a port to the host, you can specify:
-p 9000:9000
- REST API and Web Console-p 9009:9009
- InfluxDB line protocol-p 8812:8812
- Postgres wire protocol-p 9003:9003
- Min health server
#
-v volumesThe QuestDB root_directory is in the following location:
- Linux
- macOS
- Windows
#
Docker imageBy default, questdb/questdb
points to the latest QuestDB version available on
Docker. However, it is recommended to define the version used.
#
Container statusYou can check the status of your container with docker ps. It also lists the ports we published:
#
Importing data and sending queriesNow that QuestDB is running, you can start interacting with it:
- If you published the port
9000
, you can follow our REST page - If you published the port
8812
, follow our Postgres page - If you published the port
9009
, follow our InfluxDB page
#
Data persistence#
Mounting a volumeVolumes can be mounted to the QuestDB Docker container so that data may be
persisted or server configuration settings may be passed to an instance. The
following example demonstrated how to mount the current directory to a QuestDB
container using the -v
flag in a Docker run
command:
The current directory will then have data persisted to disk for convenient migration or backups:
For details on passing QuestDB server settings to a Docker container, see the Docker section of the server configuration documentation.
#
Upgrade QuestDB versionIt is possible to upgrade your QuestDB instance on Docker when a volume is mounted to maintain data persistence.
note
- Check the release note and ensure that necessary backup is completed.
- Upgrading an instance is possible only when the original instance has a volume mounted. Without mounting a volume for the original instance, the following steps create a new instance and data in the old instance cannot be retrieved.
- Run
docker ps
to copy the container name or ID:
- Stop the instance and then remove the container:
- Download the latest QuestDB image:
- Start a new container with the new version and the same volume mounted:
#
Writing logs to diskWhen mounting a volume to a Docker container, a logging configuration file may
be provided in the container located at /conf/log.conf
:
For example, a file with the following contents can be created:
The current directory can be mounted:
The container logs will be written to disk using the logging level and file name
provided in the conf/log.conf
file, in this case in ./questdb-docker.log
:
For more information on logging, see the configuration reference documentation.
#
Restart an existing containerRunning the following command will create a new container for the QuestDB image:
By giving the container a name with --name container_name
, we have an easy way
to refer to the container created by run later on:
If we want to re-use this container and its data after it has been stopped, we can use the following commands:
Alternatively, users can obtain a running container's ID with 'docker ps' and restart it using the UUID short identifier: