Skip to content

Logiqx/mysql-client

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 

Repository files navigation

MySQL Client for Docker

This image has been created to satisfy the following requirements:

  • Use official base images - Alpine and Debian (slim)
  • Use specific release of the mysql client and tools such as mysqladmin
  • Avoid running as the root user

Usage

When a container is run without arguments the MySQL client version will be displayed:

docker container run -it --rm logiqx/mysql-client

The MySQL client can be used interactively, connecting to a database as follows:

docker run -it --rm --network NETWORK_ID logiqx/mysql-client \
       mysql --host=HOSTNAME --database=DATABASE --user=USERNAME --password

Alternative MySQL command line tools such as "mysqladmin" can be run as follows:

docker run -it --rm --network NETWORK_ID logiqx/mysql-client \
       mysqladmin ping --wait --connect_timeout=60 --host=HOSTNAME --user=USERNAME --password

Note: The examples above will automatically prompt for the user password.

Using the Debian Image

The Debian image is used in much the same way as the Alpine image by specifying the appropriate tag:

docker container run -it --rm logiqx/mysql-client:10.5.12-slim-bullseye

Building a Custom Image

To build a custom image for a specific version of the MySQL client or Alpine use the following syntax:

docker image build --build-arg MARIADB_VERSION=10.6.4 . -t mysql-client:10.6.4-alpine3.15

To build a custom Debian image simply use Dockerfile-slim instead of Dockerfile:

docker image build --build-arg MARIADB_VERSION=10.5.12 . -f Dockerfile-slim -t mysql-client:10.5.12-slim-bullseye

You can provide overrides for the following:

  • MARIADB_VERSION - default of ~10.5
  • ALPINE_VERSION / DEBIAN_VERSION - default of 3.15 / bullseye
  • MYSQL_USER and MYSQL_GROUP - default of mysql
  • MYSQL_UID and MYSQL_GID - default of 1000

About

MySQL client for Docker - Alpine + Debian (slim)

Resources

License

Stars

Watchers

Forks

Packages

No packages published