Important: This page describes the SqlBak Preview product (Docker image pranasnet/sqlbak-agent). If you need the regular SqlBak, see pranasnet/sqlbak on Docker Hub.
SqlBak is an application that allows you to create database backups and send them to the cloud storage.
This Docker image contains the SqlBak application (SqlBak Agent) and utilities for interacting with databases, such as mysql, mysqldump, psql, pg_dump, etc.
pranasnet/sqlbak-agent:mysqlpranasnet/sqlbak-agent:postgresqlpranasnet/sqlbak-agent:mssqlTo start working with SqlBak you need to connect the application to app.sqlbak.com and set up a connection to the database. You can configure the container in two ways – either by running several commands inside the container, or by passing environment variables to the container.
When starting one instance of SqlBak, it can be convenient to configure the connection by executing commands using the SqlBak utility inside the container.
Run SqlBak container (replace the tag with one of: mysql, postgresql, mssql):
docker run -d \
--name sqlbak_agent \
-v sqlbak_data:/etc/sqlbak.net \
--restart unless-stopped \
pranasnet/sqlbak-agent:mssqlLink your application to app.sqlbak.com:
docker exec -i sqlbak_agent sqlbak agent connect --secret-key=[secret_key] --server-name=[name_on_dashboard]After linking, add a database connection from the SqlBak web UI or by using the sqlbak CLI inside the container. For CLI usage details, see the SqlBak Command Line Interface documentation.
Setting up a SqlBak container through environment variables is convenient for automation. At startup the container will link to your account on app.sqlbak.com and create a database connection based on the variables. If a connection with the same internal id already exists, the container will skip creating it on subsequent runs.
The environment variables below map to SqlBak database connection settings. For detailed descriptions of database-specific options, see the Database Connection Settings documentation.
SECRET_KEY – secret key from the download page (required for automatic account connection)SOURCE_TYPE – database type: mysql | postgresql | mssql (required for automatic database source creation)HOST – database host or instance/network address (required for database source creation)USER_NAME – database userUSER_PASSWORD – database user passwordPORT – port for MySQL or PostgreSQL connectionSERVER_NAME – SqlBak Agent display name in app.sqlbak.com (optional)NAME – database source display name in app.sqlbak.com (optional)POSTGRESQL_BIN_FOLDER – path to the PostgreSQL client tools folder containing psql and pg_dump. Usually detected automatically.CONNECTED_DATABASE – database used to establish the PostgreSQL connection. If not specified, SqlBak uses the default value from the source settings.MYSQL_BIN_FOLDER – path to the MySQL client tools folder. Usually detected automatically.MAX_PACKET_SIZE – maximum allowed packet size for MySQL operations.LOGIN_PATH – MySQL Login Path name created with mysql_config_editor. Can be used instead of providing a password directly.AUTH_METHOD – MySQL authentication method used by the source connection settings.TRUST_SERVER_CERTIFICATE – set to true to trust the SQL Server certificate without validating it. This is useful for self-signed certificates, but should only be used in trusted environments.CONNECTION_ENCRYPT – SQL Server encryption mode: Mandatory, Optional, or Strict.CONNECT_TIMEOUT – time in seconds to wait while opening a database connection.COMMAND_TIMEOUT – time in seconds to wait for database commands to complete.SSH_TUNNEL_SETTINGS – JSON object with SSH tunnel settings for connecting to a database that is not directly accessible from the container.Database-specific documentation: MySQL connection, PostgreSQL connection, Microsoft SQL Server connection.
Note: The HOST variable should be the hostname or IP address visible from the SqlBak container. When connecting to an external database (e.g., Amazon RDS, Azure), use the public hostname. When connecting to a database in another Docker container, both containers must share the same Docker network — use Docker Compose (which handles networking automatically) or pass --network to docker run.
Run the container and configure it immediately:
docker run -d \
--name sqlbak_agent \
-e SECRET_KEY=[secret_key] \
-e SERVER_NAME=[name_on_dashboard] \
-e SOURCE_TYPE=[mysql|postgresql|mssql] \
-e HOST=[host-name] \
-e PORT=[port] \
-e USER_NAME=[db_user] \
-e USER_PASSWORD=[db_password] \
-v sqlbak_data:/etc/sqlbak.net \
--restart unless-stopped \
pranasnet/sqlbak-agent:postgresqlservices:
mysql:
image: mysql:latest
environment:
MYSQL_ROOT_PASSWORD: rootpassword
MYSQL_DATABASE: mydatabase
MYSQL_USER: myuser
MYSQL_PASSWORD: mypassword
sqlbak:
image: pranasnet/sqlbak-agent:mysql
environment:
SECRET_KEY: ${SECRET_KEY}
SOURCE_TYPE: mysql
HOST: mysql
PORT: 3306
USER_NAME: root
USER_PASSWORD: rootpassword
volumes:
- sqlbak_data:/etc/sqlbak.net/
depends_on:
- mysql
volumes:
sqlbak_data:
services:
postgres:
image: postgres:latest
environment:
POSTGRES_USER: myuser
POSTGRES_PASSWORD: mypassword
POSTGRES_DB: mydatabase
sqlbak:
image: pranasnet/sqlbak-agent:postgresql
environment:
SECRET_KEY: ${SECRET_KEY}
SOURCE_TYPE: postgresql
HOST: postgres
PORT: 5432
USER_NAME: myuser
USER_PASSWORD: mypassword
volumes:
- sqlbak_data:/etc/sqlbak.net/
depends_on:
- postgres
volumes:
sqlbak_data:
services:
mssql:
image: mcr.microsoft.com/mssql/server:2019-latest
environment:
ACCEPT_EULA: "Y"
SA_PASSWORD: "MyStrongP@ssword"
MSSQL_PID: "Express"
volumes:
- backup_folder:/var/tmp/sqlbak.net
- mssql_data:/var/opt/mssql
sqlbak:
image: pranasnet/sqlbak-agent:mssql
environment:
SECRET_KEY: ${SECRET_KEY}
SOURCE_TYPE: mssql
HOST: mssql
USER_NAME: sa
USER_PASSWORD: "MyStrongP@ssword"
volumes:
- backup_folder:/var/tmp/sqlbak.net
- sqlbak_data:/etc/sqlbak.net/
depends_on:
- mssql
volumes:
backup_folder:
mssql_data:
sqlbak_data:
Microsoft SQL Server backups require file transfer between the environment where the DBMS is running and the SqlBak container.
Microsoft SQL Server: create a volume for /var/tmp/sqlbak.net. This directory must be shared between the SqlBak container and the environment where SQL Server is located.
If SQL Server is on the host system, run SqlBak with:
docker run -d \
...\
-v /var/tmp/sqlbak.net:/var/tmp/sqlbak.net \
pranasnet/sqlbak-agent:mssqlIf SQL Server is in another container, mount the same named volume for both containers:
docker run -d ... -v sqlbak_backup_folder:/var/tmp/sqlbak.net pranasnet/sqlbak-agent:mssql
docker run -d ... -v sqlbak_backup_folder:/var/tmp/sqlbak.net mcr.microsoft.com/mssql/server:2019-latest
Connecting SqlBak to Amazon RDS PostgreSQL
docker run -d \
--name sqlbak_rds_pg \
-e SECRET_KEY=[secret key] \
-e SERVER_NAME=my_rds_postgresql \
-e SOURCE_TYPE=postgresql \
-e USER_NAME=postgres \
-e USER_PASSWORD=my-secret-password \
-e HOST=myinstance.rds.amazonaws.com \
-v sqlbak_data:/etc/sqlbak.net \
--restart unless-stopped \
pranasnet/sqlbak-agent:postgresqlSqlBak and SQL Server in docker-compose with a shared backup folder
services:
mssql:
image: mcr.microsoft.com/mssql/server:2019-latest
environment:
ACCEPT_EULA: "Y"
SA_PASSWORD: secretPassword1
volumes:
- backup_folder:/var/tmp/sqlbak.net
sqlbak:
image: pranasnet/sqlbak-agent:mssql
environment:
SECRET_KEY: [secret key]
SERVER_NAME: name_on_dashboard
SOURCE_TYPE: mssql
USER_NAME: sa
USER_PASSWORD: secretPassword1
HOST: mssql
volumes:
- backup_folder:/var/tmp/sqlbak.net
- sqlbak_data:/etc/sqlbak.net/
volumes:
backup_folder:
sqlbak_data:--restart unless-stopped./etc/sqlbak.net, so a named volume is recommended for this path to preserve settings across updates.sqlbak CLI. To see supported commands run: docker exec [container-id] sqlbak --help.Content type
Image
Digest
sha256:a9f3a5ae2…
Size
135.4 MB
Last updated
12 days ago
docker pull pranasnet/sqlbak-agent:standalone