Portainer Templates logo

Portainer Templates

DbGate DbGate

Stack

DatabaseDevelopmentTools

Database manager in the browser for PostgreSQL, MySQL, MariaDB, SQL Server, SQLite, MongoDB, Redis and more: browse and edit tables, write queries, compare schemas, draw diagrams and import or export data. Source: https://github.com/dbgate/dbgate

Image details

Pulls: 2.7M
Architecture: amd64, arm64, arm/v7
Image size: 104 MB
Latest: 7.3.2-alpine
User: dbgate
Created: Oct 01, 2017
Updated: 4 days ago
Status: active

Source details

Stars: 7k
Forks: 485
Language: JavaScript
License: GPL-3.0
Updated: 13 hours ago
Website: www.dbgate.io/

Configuration

Type
Compose
Platform
linux
Image
dbgate/dbgate:latest
Ports
${DBGATE_PORT:-3600}:3000
Volumes
/root/.dbgate : dbgate-data
Env vars
LOGIN=adminPASSWORD=${DBGATE_PASSWORD:?Set a password}DBGATE_PASSWORD=''DBGATE_PORT=3600
Restart
unless-stopped
Source

Notes

Set a password before you deploy, since the stack won't start without one. Then open http://<your-host>:3600 (or whichever port you picked) and log in as admin. Each browser gets asked once about anonymous usage analytics, which stay off unless you say yes. Add your databases with New Connection, and use dockerhost as the server for one published on the Docker host itself. A restart logs you out, nothing else is lost. Saved connections, queries and uploads live in the dbgate-data volume. Whenever someone opens it, DbGate's server also asks dbgate.cloud for new shared scripts and a premium advert, mentioning which kinds of database you use. Docs: docs.dbgate.io

Standalone Install

Select an install method, to see config/commands for deploying DbGate

Installation method

Install on Portainer

Import all app templates into your Portainer instance, for easy 1-click deploys

  1. Ensure both Docker and Portainer are installed, and up-to-date
  2. Log into your Portainer web UI
  3. Under Settings → App Templates, paste the below URL
  4. Head to Home → App Templates, and the list of apps will show up
  5. Select DbGate, fill in any config options, and hit Deploy

Template Import URL

https://raw.githubusercontent.com/Lissy93/portainer-templates/main/templates.json
Show Me demo
Original stackfile

The compose file this template deploys, straight from its repo:

services:
  dbgate:
    image: dbgate/dbgate:latest
    restart: unless-stopped
    ports:
      - "${DBGATE_PORT:-3600}:3000"
    environment:
      LOGIN: admin
      PASSWORD: ${DBGATE_PASSWORD:?Set a password}
    volumes:
      - dbgate-data:/root/.dbgate

volumes:
  dbgate-data:

Or deploy it directly from the source:

git clone https://github.com/NotAFlightRisk/portainer-templates-extras
cd portainer-templates-extras
docker compose -f apps/dbgate/compose.yml up -d

More install options in our documentation, or see dbgate/dbgate for app-specific guidance.

DbGate - community edition

Supported databases

  • Microsoft SQL Server
  • MySQL
  • MariaDB
  • PostgreSQL
  • Oracle
  • CockroachDB
  • Amazon Redshift
  • MongoDB
  • Redis
  • SQLite (don't use alpine version if you need SQLite)
  • ClickHouse
  • Firebird
  • DuckDB

DbGate web: https://www.dbgate.io
Live demo on: https://demo.dbgate.org
Source code on GitHub: https://github.com/dbgate/dbgate/

How to Use This Image

Pull the image from the Docker Hub Repository
docker pull dbgate/dbgate
Use the following command to start a container with DbGate
docker run -it --name dbgate-instance --restart always -p <port on host>:3000 dbgate/dbgate
If you want to preconfigure connections:
docker run -it --name dbgate-instance --restart always -p <port on host>:3000 -e CONNECTIONS='mssql' -e LABEL_mssql='MS SQL' -e SERVER_mssql='SERVER_IP' -e USER_mssql='USER' -e PASSWORD_mssql='PWD' -e ENGINE_mssql='mssql@dbgate-plugin-mssql'  dbgate/dbgate

If you want to define connections in application, don't define CONNECTIONS environment variable. Instead, define volume mapping, so that saved connections are persisted. Volume mapping is needed also for persisting saved scripts, archives, application layers etc.
Or use following docker-compose fragment:
version: '3'
services:
  dbgate:
    image: dbgate/dbgate
    restart: always
    ports:
      - 80:3000
    volumes:
      - dbgate-data:/root/.dbgate
    environment:
      CONNECTIONS: con1,con2,con3,con4

      LABEL_con1: MySql
      SERVER_con1: mysql
      USER_con1: root
      PASSWORD_con1: TEST
      PORT_con1: 3306
      ENGINE_con1: mysql@dbgate-plugin-mysql

      LABEL_con2: Postgres
      SERVER_con2: postgres
      USER_con2: postgres
      PASSWORD_con2: TEST
      PORT_con2: 5432
      ENGINE_con2: postgres@dbgate-plugin-postgres

      LABEL_con3: MongoDB
      URL_con3: mongodb://mongo:27017
      ENGINE_con3: mongo@dbgate-plugin-mongo

      LABEL_con4: SQLite
      FILE_con4: /home/jan/feeds.sqlite
      ENGINE_con4: sqlite@dbgate-plugin-sqlite

volumes:
  dbgate-data:
    driver: local

Environment variables

For complete list of available environment variable settings, please use documentation

Check the logs first

Nine times out of ten the logs tell you exactly what went wrong.

  • In Portainer, go to Containers, click the container, then Logs. Or run docker logs <container>
  • Exit codes help too: 137 means killed, usually out of memory. 126 or 127 means the command inside the image is broken.

Image won't pull

Test the pull directly on the host: docker pull dbgate/dbgate:latest

  • "manifest unknown" means the tag no longer exists. This template uses latest, so try pinning a specific version instead.
  • "toomanyrequests" is the Docker Hub rate limit. Log in with docker login to raise it.
  • "no space left on device" means a full disk. Reclaim space with docker system prune

"exec format error"

This means the image was built for a different CPU architecture than your server.

  • This image supports: amd64, arm64, arm/v7
  • Check yours with uname -m: x86_64 is amd64, aarch64 is arm64. Raspberry Pi and other ARM boards are the usual culprits.

Container keeps restarting

The unless-stopped restart policy relaunches the app after every crash, so the real error can scroll past.

  • Check the logs right after a restart, the last few lines before it died are the useful ones.
  • Get the exit code with docker inspect <container> --format '{{.State.ExitCode}}'
  • Still stuck? Redeploy once with the restart policy set to no so the failure stays visible.

Required settings are blank

DBGATE_PASSWORD has no default value, and dbgate may crash or misbehave if left empty.

  • Fill it in on the deploy screen before hitting deploy.

Stack won't deploy

Compose stacks fail fast on small mistakes, and Portainer shows the reason just above the editor.

  • YAML only accepts spaces for indentation, a single tab breaks the whole file.

Raise an issue

Found something which isn't working as it should? Here's how to report it.

A Compose stack

DbGate is a Compose stack, a set of containers defined in one file and brought up together by Portainer, then started and stopped as a single app.

The app image

An image is the app packed up ready to go, everything DbGate needs bundled into one download. This template pulls dbgate/dbgate:latest, which Docker fetches once (about 104 MB) and then starts your own copy from.

Where the image comes from

Docker pulls its images from registries, public libraries of ready-built apps. DbGate's comes from Docker Hub, published by dbgate.

Version tags

The bit after the colon in the image name is the version tag. Here it's latest, which always points at the newest build, so a redeploy can bump you to a newer release without you asking. Newest right now is 7.3.2-alpine. Pin a specific tag if you would rather stay on one version.

Which machines it runs on

Every image is built for particular CPU types. This one ships for amd64, arm64, arm/v7, so it runs on both regular x86 servers and ARM boards like a Raspberry Pi.

Volumes

A volume is where DbGate keeps its files so they survive an update or a restart. Without one, anything it saves would sit inside the container and vanish the moment it's recreated. This template mounts:

  • /root/.dbgate kept in the dbgate-data volume Docker manages

Environment variables

Environment variables are the settings you hand over when you deploy, things like a password or a timezone. DbGate takes 4 of them, and 2 need a value before it'll start properly:

  • LOGIN, defaults to admin
  • PASSWORD, needs a value
  • DBGATE_PASSWORD, needs a value. For logging in as admin. DbGate has no login at all without one, hence required.
  • DBGATE_PORT, defaults to 3600. Host port for the web UI

Restart policy

The restart policy here is unless-stopped, so Docker restarts DbGate after a crash or reboot, but leaves it off when you stop it on purpose. You can change this on the deploy screen. The choices are no (never restart), on-failure (only after a crash), unless-stopped (restart unless you stop it), and always (bring it back no matter what).

Networking

Nothing custom is set, so DbGate sits on Docker's default bridge network: its own private space that reaches the outside world only through the ports it publishes.

Container name

Once it's deployed, Portainer names the container dbgate. That's what you'll spot in the containers list and use in commands like docker logs dbgate.

Platform

The platform is linux, the kind of system the container is built to run on. Docker and Portainer handle this on a normal Linux server.

Open source license

DbGate is open source, released under the GPL-3.0 license. In plain terms the code is out in the open, so you're free to run it and change it to fit what you need.

Portainer app templates

Zooming out, this whole page comes from a Portainer app template: a short recipe telling Portainer how to set DbGate up. Add the template list to Portainer once, then deploying DbGate is a click rather than a wall of config.