Install CrateDB Inside Docker Container in Linux

Install CrateDB Inside Docker Container in Linux

CrateDB is a distributed SQL database for relational and time-series data. CreateDB is an open-source project released under the Apache License 2.0.

This tutorial explains how to install CrateDB inside a Docker container in the Linux. Commands have been tested on Ubuntu.

Prepare environment

Make sure you have installed Docker in your system. If you are using Ubuntu, installation instructions can be found in the post.

Install CrateDB

  • Host network

Run the following command to create a container for CrateDB that uses host network:

docker run -d --name=cratedb --restart=always --network=host \
    -v /opt/cratedb/data:/data \
    crate -Cdiscovery.type=single-node
  • User-defined bridge network

User-defined bridge network can be used for listening on different port. By default, CrateDB transport service is listening on port 4300 and CrateDB Postgres service is listening on port 5432. Admin UI is available on port 4200. Ports can be changed with -p option.

docker network create app-net
docker run -d --name=cratedb --restart=always --network=app-net \
    -p 8080:4200 -p 8081:4300 -p 8082:5432 \
    -v /opt/cratedb/data:/data \
    crate -Cdiscovery.type=single-node

Testing CrateDB

To access admin UI, open a web browser and go to http://<IP_ADDRESS>:4200, where <IP_ADDRESS> is the IP address of the system.

CrateDB Inside Docker Container in Linux

Uninstall CrateDB

To completely remove CrateDB, remove its container:

docker rm --force cratedb

Remove CrateDB image:

docker rmi crate

You can also remove CrateDB data:

sudo rm -rf /opt/cratedb

If a user-defined bridge network was created, you can delete it as follows:

docker network rm app-net

Leave a Comment

Cancel reply

Your email address will not be published.