DEV Community

Cover image for A FREE and Open Source Airtable Alternative - How to Spin Up NocoDB Using Docker
Lukas Mauser
Lukas Mauser Subscriber

Posted on • Originally published at sliplane.io

A FREE and Open Source Airtable Alternative - How to Spin Up NocoDB Using Docker

NocoDB is an open-source Airtable alternative. On their site they claim that it "allows building no-code database solutions with ease of spreadsheets." You can turn any database into a smart spreadsheet interface, create forms, build APIs, and collaborate with your team.

In this guide, I want to show you how easy it is to spin up your own instance of this free database management tool in the cloud using Docker and Sliplane.

Local testing

You can test the setup locally on your computer. Just make sure Docker Desktop is installed and running on your machine. However its even easier if you do it directly in Sliplane, what I will describe in the next section.

With SQLite

Open a terminal and run:

docker run -d --name nocodb \ -v "$(pwd)"/nocodb:/usr/app/data/ \ -p 8080:8080 \ nocodb/nocodb:0.263.8 
Enter fullscreen mode Exit fullscreen mode

What happens here:

  • We use docker run to spin up a new container
  • We name it nocodb, you can choose a different name
  • We mount a new volume to /usr/app/data, this means everything nocodb saves in this directory will be stored outside the container and persist even if the container gets shut down or destroyed at some point. Nocodb will create our SQLite database file in here
  • We map port 8080 inside the container to 8080 on our host
  • We specify the image to run: nocodb/nocodb along with the version of the image (here: 0.263.8, but you can use a different version if needed)

You can test if the app is running by navigating to http://localhost:8080 in your web browser. Documentation for how you can configure NocoDB can be found on Dockerhub.

NocoDB Login Screen

Login Screen after first install.

With Postgres

If you want to use postgres as the underlying database, you need to run a postgres container first:

  1. Create a new network
docker network create nocodb-net 
Enter fullscreen mode Exit fullscreen mode

Start a postgres container with the following command:

docker run --name nocodb-postgres \ -e POSTGRES_PASSWORD=mysecretpassword \ -e POSTGRES_DATABASE=nocodb \ -v "$(pwd)"/postgres:/var/lib/postgresql/data \ --network nocodb-net \ -d postgres:17.2 
Enter fullscreen mode Exit fullscreen mode

What happens here:

  • We use docker run to spin up a new container
  • We name it nocodb-postgres, you can choose a different name
  • We set a database and password with the -e envs
  • We mount a new volume to /var/lib/postgresql/data, this means everything postgres saves in this directory will be stored outside the container and persist even if the container gets shut down or destroyed at some point. Note: Postgres changed this mount path after version 18 - please always refer to the docs, depending on what version you are using
  • We specify the image to run: postgres along with the version of the image

In this case, I used 17.2 as the version. Make sure to check the postgres documentation on Docker Hub to find configurations that matches the pg version you are using.

Next, start the nocodb container and connect it to the postgres database:

docker run -d --name nocodb \ -v "$(pwd)"/nocodb:/usr/app/data/ \ -p 8080:8080 \ --network nocodb-net \ -e NC_DB="pg://nocodb-postgres:5432?u=postgres&p=mysecretpassword&d=nocodb" \ -e NC_AUTH_JWT_SECRET="your-jwt-auth-secret" \ nocodb/nocodb:0.263.8 
Enter fullscreen mode Exit fullscreen mode

What happens here:

  • We use docker run to spin up a new container
  • We name it nocodb, you can choose a different name
  • We mount a volume -v to /usr/app/data/
  • We set a JWT auth secret and the database URI in order to connect to our postgres database using the postgres user and password
  • We specify the image to run: nocodb/nocodb along with the version of the image (0.263.8)

You can now access nocodb on http://localhost:8080 on your own host.

Using docker compose

You can also use Docker Compose instead. Create a file called docker-compose.yml:

services: postgres: image: postgres:17.2 container_name: nocodb-postgres environment: POSTGRES_DB: nocodb POSTGRES_PASSWORD: mysecretpassword volumes: - postgres_data:/var/lib/postgresql/data networks: - nocodb-net restart: unless-stopped nocodb: image: nocodb/nocodb:0.263.8 container_name: nocodb depends_on: - postgres environment: NC_DB: "pg://postgres:5432?u=postgres&p=mysecretpassword&d=nocodb" NC_AUTH_JWT_SECRET: "your-jwt-auth-secret" ports: - "8080:8080" volumes: - nocodb_data:/usr/app/data networks: - nocodb-net restart: unless-stopped volumes: postgres_data: nocodb_data: networks: nocodb-net: 
Enter fullscreen mode Exit fullscreen mode

Then just run:

docker-compose up -d 
Enter fullscreen mode Exit fullscreen mode

Run in the cloud:

We use Sliplane to run it in the cloud. Sliplane makes running containers very easy and affordable in the cloud.

In general, we just follow the steps like in our local setup, but with a few simple changes, in fact, it is even easier on Sliplane.

1. Deploy a Postgres Database

Note: If you want to use SQL Lite you can skip this part and continue with step 2

  1. Log in to Sliplane with your GitHub account. In the Dashboard, click "Create Project" and name it "nocodb".
  2. Click "Deploy Service".
  3. Select a server or create a new one if you don't have one yet. To create a new one, click "Create Server", then choose the location and server type. The base server type should be enough to get started, you can scale up later if you need to.
  4. Choose Postgres from the presets. In the settings, disable the public toggle for additional security. You can also change the default database name, user, and password if you want. Then click deploy and wait for your database to deploy.

2. Deploy Nocodb

  1. In the project we created in step 1, click "Deploy Service" again.
  2. Select the server where Postgres is running and in the "Deploy From" section select "Registry".
  3. In the "Image URL" field, search for nocodb and choose the nocodb/nocodb image and a tag from the list.
  4. Add the following environment variables, but make sure to change the password, database, and internal host to match the settings from your Postgres database. I recommend you open a new tab with the Postgres service on Sliplane to grab these values from:
NC_DB="pg://[postgres.internal]:5432?u=postgres&p=[password]&d=[database]" NC_AUTH_JWT_SECRET="your-secure-jwt-secret" 
Enter fullscreen mode Exit fullscreen mode
  1. Add a volume to your nocodb service, give it a name of your choice and set the mount path to /usr/app/data
  2. Click "Deploy" and wait for the deploy to finish.

You can now access nocodb through your ...sliplane.app domain that is showing in the dashboard!

NocoDB UI

Summary

NocoDB is a solid free alternative to Airtable (although Airtable now has more product offerings beyond turining databases into spreadsheets). By self-hosting it, you get your own data and control, and pretty much the same functionality at a fraction of the cost compared to commercial SaaS options.

Setting it up with Docker on Sliplane is possible within minutes.

Top comments (2)

Collapse
 
code42cate profile image
Jonas Scholz

Is it on purpose that nocodb sounds like nocode b?

Collapse
 
wimadev profile image
Lukas Mauser

Never read it like this tbh 😆 but I guess the no code part is intentional :-D