Sign inSign up

agentlans/mariadb-sample

By agentlans

Updated over 1 year ago

MariaDB preloaded with a sample database

Image
Databases & storage
0

344

agentlans/mariadb-sample repository overview

MariaDB Sample Database

This Docker image provides the latest version of MariaDB server (11.6.2+maria~ubu2404) preloaded with MySQL's "employee" test database.

You can also find the database dump here: MariaDB Sample Database Dump

Usage

Required
  • Docker installed and running on your system.
  • A Docker network.
Starting the Container

To start a container from this image:

# Create a new network (if not already existing)
docker network create some-network

# Start the MariaDB server with sample data
docker run --detach \
--network some-network \
--name some-mariadb \
--env MARIADB_USER=example-user \
--env MARIADB_PASSWORD=my_cool_secret \
--env MARIADB_ROOT_PASSWORD=my-secret-pw \
--env MARIADB_DATABASE=employees \
agentlans/mariadb-sample

# Check that the server is running
docker ps -a | grep some-mariadb
Accessing the Database

Once the container is running, you can access it from another container on the same network. In this case, the database connection details are:

  • Host: some-mariadb
  • User: example-user
  • Password: my_cool_secret
  • Database: employees
  • Port: 3306 (the default for MariaDB and MySQL)

To access the MariaDB database running in the container:

docker exec -it \
--env MARIADB_USER=example-user \
--env MARIADB_PASSWORD=my_cool_secret \
--env MARIADB_DATABASE=employees \
some-mariadb sh -c 'mariadb -u $MARIADB_USER -p$MARIADB_PASSWORD $MARIADB_DATABASE'

Important

Any changes made to the database will not be saved when the container is shut down.
Stopping the Container
# Stop the container
docker stop some-mariadb

# Delete the container
docker rm some-mariadb

Tag summary

Content type

Image

Digest

sha256:35dd44896

Size

150.7 MB

Last updated

over 1 year ago

docker pull agentlans/mariadb-sample