Docker Compose

This guide will help you get Cube.js running using Docker Compose.

Create a docker-compose.yml file with the following content:

If you're using Linux as the Docker host OS, you'll also need to add network_mode: 'host' to your docker-compose.yml.

version: '2.2'

    image: cubejs/cube:latest
      - 4000:4000 # Cube.js API and Developer Playground
      - 3000:3000 # Dashboard app, if created
      - CUBEJS_DEV_MODE=true
      - .:/cube/conf
      # Prevent dev dependencies leaking
      - .empty:/cube/conf/node_modules/@cubejs-backend/

Using Windows? Remember to use PowerShell or WSL2 to run the command below.

$ docker-compose up -d

Check if the container is running:

$ docker-compose ps

Head to http://localhost:4000 to open Developer Playground.

The Developer Playground has a database connection wizard that loads when Cube.js is first started up and no .env file is found. After database credentials have been set up, an .env file will automatically be created and populated with the same credentials.

Click on the type of database to connect to, and you'll be able to enter credentials:

After clicking Apply, you should see tables available to you from the configured database. Select one to generate a data schema. Once the schema is generated, you can execute queries on the Build tab.

Generating Data Schema files in the Developer Playground is a good first step to start modelling your data. You can learn more about Cube.js Data Schema for complex data modelling techniques.

Learn how to query Cube.js with REST API or use our Javascript client library and integrations with frontend frameworks.

Did you find this page useful?