Container for Alpine Linux + s6 + MySQL
This image serves as the database container for applications/services
tht require a MySQL or MariaDB database running. If it is required to
run in the same container as the app is running, use this
container as the source. Can create the database specified in the
command line if not exists, has handy backup and restore commands
available inside the image.
Built from my alpine-s6 image using latest available MySQL
and cli client.
Based on Alpine Linux.
The image is tagged respectively for 2 architectures,
Get the Image
Pull the image for your architecture it's already available from
# make pull docker pull arpanpal010/alpine-mysql:x86_64
# make docker run --rm -it \ --name docker_mysql --hostname mysql \ -e PGID=100 -e PUID=1000 \ -c 512 -m 512m \ -p 3306:3306 \ -v /data:/var/lib/mysql \ -v /etc/hosts:/etc/hosts:ro \ -v /etc/localtime:/etc/localtime:ro \ -e TZ=Asia/Kolkata \ -e MYSQL_USER=mysql \ -e MYSQL_USER_PWD=mysqlpassword \ -e MYSQL_USER_DB=test \ arpanpal010/alpine-mysql:x86_64 # make stop docker stop -t 2 docker_mysql # make rm # stop first docker rm -f docker_mysql # make restart docker restart docker_mysql
# make rshell docker exec -u root -it docker_mysql /bin/bash # make shell docker exec -it docker_mysql /bin/bash # make logs docker logs -f docker_mysql
PS: this bit is for dev only as you need the files from the
# make systemd # add systemd.service as a service if it exists, load it, and start or restart # it if already running. # make backup # backup databases # the backup should be named <databasename>.sql and is dropped inside /var/lib/mysql/backups docker exec docker_mysql /scripts/run.sh backup <databasename> # make restore # restore a single databases # restores the <databasename> database from the file # /var/lib/mysql/backups/<databasename>.sql docker exec docker_mysql /scripts/run.sh restore <databasename>
If you have the repository access, you can clone and
build the image yourself for your own system, and can push after.
git clone <repository url> cd <repository>
You can always skip installing make but you will have to
type the whole docker commands then instead of using the sweet
To locally build the image for your system.
# make build docker build --rm --force-rm \ -t arpanpal010/alpine-mysql:x86_64 \ --no-cache=true --pull . # make push docker push arpanpal010/alpine-mysql:x86_64
Currently built daily on a RaspberryPi3 (armhf builds) or IntelNUC
(x64 builds). Docker hub builds maintained by arpanpal010.