Sign inSign up

dev050221/ibr_h2db

By dev050221

•Updated over 4 years ago

H2 Database Server on Alpine Linux base

Image
0

491

dev050221/ibr_h2db repository overview

⁠H2 Database Server 2.1.212 (2022-04-09) in a Container

⁠Welcome to H2, the Java SQL database - Now in a Docker container.

The main features of H2 are:

  • Very fast, open source, JDBC API
  • Embedded and server modes; in-memory databases
  • Browser based Console application
  • Small footprint: around 2 MB jar file size

More details at https://h2database.com⁠

⁠How to Use This Image

⁠Use as a Database Server
docker run --detach \
--restart unless-stopped \
--publish 8082:8082 --publish 9092:9092 \
--env CONSOLE_PWD=<password> \
--volume $PWD/scripts:/root/scripts \
--volume h2db_data:/root/data/ \
--hostname h2db \
--name h2db \
dev050221/ibr_h2db:server
⁠Use as an interactive SQL Client for H2 databases
docker run -it --rm \
--env RUN_AS="CLIENT" \
--volume $PWD/scripts:/root/scripts \
dev050221/ibr_h2db:client
⁠Use as an Interactive Client to Execute SQL Scripts
docker run -it --rm \
--env RUN_AS="SCRIPT" \
--volume $PWD/scripts:/root/scripts \
dev050221/ibr_h2db:client

You will need to keep your SQL scripts in $PWD/scripts folder for the container to execute.

⁠A Note on Image Tags

dev050221/ibr_h2db:server and dev050221/ibr_h2db:client can both be used interchangeably as server and client. dev050221/ibr_h2db:client is smaller in size. However, it will not support stored procedures and user defined functions if run as a server.

⁠Goodies

The Docker image comes with two default databases: northwind and sample with user id and password sa.

The northwind database is curtesy of YugabyteDB⁠.

sample is an empty database that is re-created if deleted.

⁠H2 Web Console

Go to https://localhost:8082⁠ for a very helpful web console.

⁠H2 Database Tools (to be run on the Docker Host)

⁠To see this message

docker exec -it h2db readme

⁠List databases on the server

docker exec -it h2db listdb

⁠Create a new database

docker exec -it h2db createdb [database name] [database owner] [password]

⁠Delete existing database

docker exec -it h2db deletedb [database name]

⁠Launch an interactive SQL client for H2 Database Server

docker exec -it h2db h2client

⁠Execute an SQL script on a database

docker exec -it h2db runscript

⁠Start/stop the H2 database server

docker exec -it h2db h2server [start | stop] <tcp password>

⁠Reset the H2 Web Console password

docker exec -it h2db resetpwd

⁠Advanced: Run misc tools provided by H2

docker exec -it h2db runtool

You can also log into the container and see the inner workings by executing

docker exec -it h2db ash

⁠Finally

This Docker image is provided "as is" without ANY assurance of suitability to purpose.

Tag summary

Content type

Image

Digest

Size

87.5 MB

Last updated

over 4 years ago

docker pull dev050221/ibr_h2db:server