Compare commits
29 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 291cb10eda | |||
| 8d3102509f | |||
| 52514b4e5e | |||
| e6eedf5385 | |||
| def1d14534 | |||
| 08c2608102 | |||
| c415496f00 | |||
| 8a6df0d489 | |||
| 4c98e019de | |||
| 5b5109a0b8 | |||
| f0efa2b9fc | |||
| 117a308944 | |||
| 49ec1145df | |||
| 1e1fccea11 | |||
| 2ef5cc7752 | |||
| 222cc91646 | |||
| a144f7ba10 | |||
| 46bb4c0250 | |||
| 3a704c2d2b | |||
| 377a47c84c | |||
| 7ad74a6828 | |||
| 277bff0c06 | |||
| dd5db4ca01 | |||
| c1d15b5799 | |||
| 0ed5cd76f6 | |||
| 6aae1c80e4 | |||
| 1c5dc6cb12 | |||
| ff53a85323 | |||
| fb0573cbae |
+20
-2
@@ -20,7 +20,7 @@
|
||||
*.PDF diff=astextplain
|
||||
*.rtf diff=astextplain
|
||||
*.RTF diff=astextplain
|
||||
*.md text
|
||||
*.md text diff=markdown
|
||||
*.tex text diff=tex
|
||||
*.adoc text
|
||||
*.textile text
|
||||
@@ -30,6 +30,7 @@
|
||||
*.tsv text
|
||||
*.txt text
|
||||
*.sql text
|
||||
*.ps1 text eol=crlf
|
||||
|
||||
# Graphics
|
||||
*.png binary
|
||||
@@ -53,7 +54,23 @@
|
||||
# These are explicitly windows files and should use crlf
|
||||
*.bat text eol=crlf
|
||||
*.cmd text eol=crlf
|
||||
*.ps1 text eol=crlf
|
||||
|
||||
# web frontend stack -- force LF so SRI hashes are always correct
|
||||
*.html text eol=lf
|
||||
*.htm text eol=lf
|
||||
*.css text eol=lf
|
||||
*.min.css text eol=lf
|
||||
*.js text eol=lf
|
||||
*.min.js text eol=lf
|
||||
*.php text eol=lf
|
||||
|
||||
# Visual Studio projects (Rider also)
|
||||
*.cs diff=csharp
|
||||
*.sln merge=union
|
||||
*.csproj merge=union
|
||||
*.vbproj merge=union
|
||||
*.fsproj merge=union
|
||||
*.dbproj merge=union
|
||||
|
||||
# Serialisation
|
||||
*.json text
|
||||
@@ -79,4 +96,5 @@
|
||||
.gitattributes export-ignore
|
||||
.gitignore export-ignore
|
||||
.gitkeep export-ignore
|
||||
.idea export-ignore
|
||||
.vscode export-ignore
|
||||
+72
-10
@@ -1,11 +1,73 @@
|
||||
# VSCode files
|
||||
.vscode/*
|
||||
!.vscode/settings.json
|
||||
!.vscode/tasks.json
|
||||
!.vscode/launch.json
|
||||
!.vscode/extensions.json
|
||||
!.vscode/numbered-bookmarks.json
|
||||
*.code-workspace
|
||||
### JetBrains template
|
||||
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
|
||||
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
|
||||
|
||||
# User-specific stuff
|
||||
.idea/**/workspace.xml
|
||||
.idea/**/tasks.xml
|
||||
.idea/**/usage.statistics.xml
|
||||
.idea/**/dictionaries
|
||||
.idea/**/shelf
|
||||
|
||||
# Generated files
|
||||
.idea/**/contentModel.xml
|
||||
|
||||
# Sensitive or high-churn files
|
||||
.idea/**/dataSources/
|
||||
.idea/**/dataSources.ids
|
||||
.idea/**/dataSources.local.xml
|
||||
.idea/**/sqlDataSources.xml
|
||||
.idea/**/dynamic.xml
|
||||
.idea/**/uiDesigner.xml
|
||||
.idea/**/dbnavigator.xml
|
||||
|
||||
# Gradle
|
||||
.idea/**/gradle.xml
|
||||
.idea/**/libraries
|
||||
|
||||
# Gradle and Maven with auto-import
|
||||
# When using Gradle or Maven with auto-import, you should exclude module files,
|
||||
# since they will be recreated, and may cause churn. Uncomment if using
|
||||
# auto-import.
|
||||
# .idea/artifacts
|
||||
# .idea/compiler.xml
|
||||
# .idea/jarRepositories.xml
|
||||
# .idea/modules.xml
|
||||
# .idea/*.iml
|
||||
# .idea/modules
|
||||
# *.iml
|
||||
# *.ipr
|
||||
|
||||
# CMake
|
||||
cmake-build-*/
|
||||
|
||||
# Mongo Explorer plugin
|
||||
.idea/**/mongoSettings.xml
|
||||
|
||||
# File-based project format
|
||||
*.iws
|
||||
|
||||
# IntelliJ
|
||||
out/
|
||||
|
||||
# mpeltonen/sbt-idea plugin
|
||||
.idea_modules/
|
||||
|
||||
# JIRA plugin
|
||||
atlassian-ide-plugin.xml
|
||||
|
||||
# Cursive Clojure plugin
|
||||
.idea/replstate.xml
|
||||
|
||||
# Crashlytics plugin (for Android Studio and IntelliJ)
|
||||
com_crashlytics_export_strings.xml
|
||||
crashlytics.properties
|
||||
crashlytics-build.properties
|
||||
fabric.properties
|
||||
|
||||
# Editor-based Rest Client
|
||||
.idea/httpRequests
|
||||
|
||||
# Android studio 3.1+ serialized cache file
|
||||
.idea/caches/build_file_checksums.ser
|
||||
|
||||
# Local History for Visual Studio Code
|
||||
.history/
|
||||
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="GitCommitMessageStorage">
|
||||
<option name="messageStorage">
|
||||
<MessageStorage />
|
||||
</option>
|
||||
</component>
|
||||
</project>
|
||||
@@ -11,5 +11,10 @@
|
||||
<option name="enabled" value="true" />
|
||||
</CommitMessageValidationOverride>
|
||||
</option>
|
||||
<option name="commitMessageValidationEnabledOverride">
|
||||
<BoolValueOverride>
|
||||
<option name="enabled" value="true" />
|
||||
</BoolValueOverride>
|
||||
</option>
|
||||
</component>
|
||||
</project>
|
||||
@@ -1,7 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="RIDER_MODULE" version="4">
|
||||
<component name="NewModuleRootManager">
|
||||
<content url="file://$MODULE_DIR$/../.." />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
||||
Generated
+8
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="GitCommitMessageStorage">
|
||||
<option name="messageStorage">
|
||||
<MessageStorage />
|
||||
</option>
|
||||
</component>
|
||||
</project>
|
||||
Generated
+6
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="GitToolBoxBlameSettings">
|
||||
<option name="version" value="2" />
|
||||
</component>
|
||||
</project>
|
||||
Generated
+15
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="GitToolBoxProjectSettings">
|
||||
<option name="commitMessageIssueKeyValidationOverride">
|
||||
<BoolValueOverride>
|
||||
<option name="enabled" value="true" />
|
||||
</BoolValueOverride>
|
||||
</option>
|
||||
<option name="commitMessageValidationEnabledOverride">
|
||||
<BoolValueOverride>
|
||||
<option name="enabled" value="true" />
|
||||
</BoolValueOverride>
|
||||
</option>
|
||||
</component>
|
||||
</project>
|
||||
Generated
+8
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="UserContentModel">
|
||||
<attachedFolders />
|
||||
<explicitIncludes />
|
||||
<explicitExcludes />
|
||||
</component>
|
||||
</project>
|
||||
Generated
+8
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="RiderProjectSettingsUpdater">
|
||||
<option name="singleClickDiffPreview" value="1" />
|
||||
<option name="unhandledExceptionsIgnoreList" value="1" />
|
||||
<option name="vcsConfiguration" value="3" />
|
||||
</component>
|
||||
</project>
|
||||
Generated
+15
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="CommitMessageInspectionProfile">
|
||||
<profile version="1.0">
|
||||
<inspection_tool class="BodyLimit" enabled="true" level="ERROR" enabled_by_default="true" />
|
||||
<inspection_tool class="SubjectBodySeparation" enabled="true" level="ERROR" enabled_by_default="true" />
|
||||
<inspection_tool class="SubjectLimit" enabled="true" level="WARNING" enabled_by_default="true">
|
||||
<option name="RIGHT_MARGIN" value="50" />
|
||||
</inspection_tool>
|
||||
</profile>
|
||||
</component>
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
||||
+14
-5
@@ -1,21 +1,29 @@
|
||||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="Dockerfile" type="docker-deploy" factoryName="dockerfile" server-name="Docker LOCAL">
|
||||
<configuration default="false" name="Dockerfile" type="docker-deploy" factoryName="dockerfile" server-name="Docker">
|
||||
<deployment type="dockerfile">
|
||||
<settings>
|
||||
<option name="imageTag" value="docker.asifbacchus.dev/mariadb/ab-mariadb-alpine:10.5.13" />
|
||||
<option name="imageTag" value="docker.asifbacchus.dev/mariadb/ab-mariadb-alpine:11.4.12-r0" />
|
||||
<option name="buildArgs">
|
||||
<list>
|
||||
<DockerEnvVarImpl>
|
||||
<option name="name" value="ALPINE_VERSION" />
|
||||
<option name="value" value="3.24" />
|
||||
</DockerEnvVarImpl>
|
||||
<DockerEnvVarImpl>
|
||||
<option name="name" value="MARIADB_VERSION" />
|
||||
<option name="value" value="11.4.12-r0" />
|
||||
</DockerEnvVarImpl>
|
||||
<DockerEnvVarImpl>
|
||||
<option name="name" value="INTERNAL_VERSION" />
|
||||
<option name="value" value="1.2" />
|
||||
<option name="value" value="2.3.1" />
|
||||
</DockerEnvVarImpl>
|
||||
<DockerEnvVarImpl>
|
||||
<option name="name" value="GIT_COMMIT" />
|
||||
<option name="value" value="af07af2015" />
|
||||
<option name="value" value="52514b4e5e" />
|
||||
</DockerEnvVarImpl>
|
||||
<DockerEnvVarImpl>
|
||||
<option name="name" value="BUILD_DATE" />
|
||||
<option name="value" value="2022-02-19" />
|
||||
<option name="value" value="2026-09-12" />
|
||||
</DockerEnvVarImpl>
|
||||
</list>
|
||||
</option>
|
||||
@@ -23,6 +31,7 @@
|
||||
<option name="sourceFilePath" value="Dockerfile" />
|
||||
</settings>
|
||||
</deployment>
|
||||
<EXTENSION ID="com.jetbrains.rider.docker.debug" isFastModeEnabled="true" isSslEnabled="false" />
|
||||
<method v="2" />
|
||||
</configuration>
|
||||
</component>
|
||||
+15
-5
@@ -2,9 +2,9 @@
|
||||
# mariadb running on Alpine Linux
|
||||
#
|
||||
|
||||
# version arguments
|
||||
ARG ALPINE_VERSION="3.14"
|
||||
ARG MARIADB_VERSION="10.5.13-r0"
|
||||
# build arguments
|
||||
ARG ALPINE_VERSION="3.24"
|
||||
ARG MARIADB_VERSION="11.4.12-r0"
|
||||
|
||||
FROM alpine:${ALPINE_VERSION}
|
||||
ARG ALPINE_VERSION
|
||||
@@ -22,7 +22,7 @@ LABEL org.opencontainer.image.url="https://git.asifbacchus.dev/ab-docker/ab-mari
|
||||
LABEL org.opencontainer.image.vendor="Asif Bacchus <asif@asifbacchus.dev>"
|
||||
|
||||
# install mariadb and turn on TCP connection in default config
|
||||
RUN apk --no-cache --update add \
|
||||
RUN apk --update --no-cache add \
|
||||
tzdata \
|
||||
mariadb>${MARIADB_VERSION} \
|
||||
mariadb-client>${MARIADB_VERSION} \
|
||||
@@ -36,6 +36,14 @@ EXPOSE 3306
|
||||
# create volume if user forgets
|
||||
VOLUME ["/var/lib/mysql"]
|
||||
|
||||
# basic healthcheck (service only)
|
||||
HEALTHCHECK \
|
||||
--interval=30s \
|
||||
--timeout=5s \
|
||||
--start-period=5s \
|
||||
--retries=3 \
|
||||
CMD mysqladmin ping --silent
|
||||
|
||||
# set environment variables
|
||||
ENV TZ=Etc/UTC
|
||||
ENV MYSQL_UID=8100
|
||||
@@ -52,12 +60,14 @@ ENV MYSQL_PASSWORD=''
|
||||
COPY entrypoint.sh /usr/local/bin/entrypoint.sh
|
||||
RUN mkdir -p /docker-entrypoint-preinit.d \
|
||||
&& mkdir -p /docker-entrypoint-initdb.d \
|
||||
&& mkdir -p /docker-entrypoint-postinit.d
|
||||
&& mkdir -p /docker-entrypoint-postinit.d \
|
||||
&& chmod +x /usr/local/bin/entrypoint.sh
|
||||
|
||||
# set entrypoint and default command
|
||||
ENTRYPOINT [ "/usr/local/bin/entrypoint.sh" ]
|
||||
CMD [ "/usr/bin/mysqld", "--user=mysql", "--console" ]
|
||||
|
||||
# add parameters, version and build date labels
|
||||
# set build timestamp and version labels
|
||||
ARG INTERNAL_VERSION
|
||||
ARG GIT_COMMIT
|
||||
|
||||
@@ -5,58 +5,59 @@ half the size of the official MariaDB container which runs on Ubuntu but still a
|
||||
adding a few extra ;-) Note that this container is built against the Alpine EDGE repository for newer versions of
|
||||
mariaDB.
|
||||
|
||||
<!-- toc -->
|
||||
|
||||
- [Quick Start](#quick-start)
|
||||
- [Pull the image](#pull-the-image)
|
||||
- [Run the image](#run-the-image)
|
||||
- [Create a database](#create-a-database)
|
||||
- [Root password](#root-password)
|
||||
- [User password](#user-password)
|
||||
* [Pull the image](#pull-the-image)
|
||||
* [Run the image](#run-the-image)
|
||||
* [Create a database](#create-a-database)
|
||||
+ [Root password](#root-password)
|
||||
+ [User password](#user-password)
|
||||
- [Connecting as a client](#connecting-as-a-client)
|
||||
- [Direct-to-Container](#direct-to-container)
|
||||
- [Separate Container](#separate-container)
|
||||
* [Direct-to-Container](#direct-to-container)
|
||||
* [Separate Container](#separate-container)
|
||||
- [Shell Access](#shell-access)
|
||||
- [Checking Logs](#checking-logs)
|
||||
- [Environment Variables](#environment-variables)
|
||||
- [System-related](#system-related)
|
||||
- [MariaDB configuration](#mariadb-configuration)
|
||||
- [Database configuration](#database-configuration)
|
||||
* [System-related](#system-related)
|
||||
* [MariaDB configuration](#mariadb-configuration)
|
||||
* [Database configuration](#database-configuration)
|
||||
- [Root Account](#root-account)
|
||||
- [Integrated-account](#integrated-account)
|
||||
- [Root-at-any-host](#root-at-any-host)
|
||||
* [Integrated-account](#integrated-account)
|
||||
* [Root-at-any-host](#root-at-any-host)
|
||||
- [Data Persistence](#data-persistence)
|
||||
- [Data instantiation/import](#data-instantiationimport)
|
||||
- [Existing DB (mysql directory)](#existing-db-mysql-directory)
|
||||
- [Instantiation](#instantiation)
|
||||
* [Existing DB (mysql directory)](#existing-db-mysql-directory)
|
||||
* [Instantiation](#instantiation)
|
||||
- [Custom Scripts](#custom-scripts)
|
||||
- [Entrypoint Task Order](#entrypoint-task-order)
|
||||
* [Entrypoint Task Order](#entrypoint-task-order)
|
||||
- [Custom Configuration](#custom-configuration)
|
||||
- [Command-line parameters](#command-line-parameters)
|
||||
- [Configuration file(s)](#configuration-files)
|
||||
* [Command-line parameters](#command-line-parameters)
|
||||
* [Configuration file(s)](#configuration-files)
|
||||
- [Database dumps](#database-dumps)
|
||||
- [Healthcheck](#healthcheck)
|
||||
- [Source](#source)
|
||||
- [Final Thoughts](#final-thoughts)
|
||||
|
||||
<!-- tocstop -->
|
||||
|
||||
## Quick Start
|
||||
|
||||
### Pull the image
|
||||
|
||||
The latest images are on my private docker registry but, I also try to keep the ones on Dockerhub updated within a few
|
||||
days. If you need signed containers, you will have to use my private registry. As such, you have two choices:
|
||||
The latest images are on my private docker registry. I also try to keep the ones on Dockerhub updated within a few
|
||||
days.
|
||||
|
||||
```bash
|
||||
# my private repo
|
||||
docker pull asifbacchus/ab-mariadb-alpine:latest
|
||||
```
|
||||
# pull from my private repo
|
||||
docker pull docker.asifbacchus.dev/mariadb/ab-mariadb-alpine:latest
|
||||
|
||||
or
|
||||
|
||||
```bash
|
||||
# dockerhub
|
||||
# pull from dockerhub
|
||||
docker pull asifbacchus/ab-mariadb-alpine:latest
|
||||
```
|
||||
|
||||
The examples in this document will refer to dockerhub, but know that anywhere you
|
||||
see `asifbacchus/ab-mariadb-alpine:tag` you can use `docker.asifbacchus.app/mariadb/ab-mariadb-alpine` to use my
|
||||
see `asifbacchus/ab-mariadb-alpine:tag` you can use `docker.asifbacchus.app/mariadb/ab-mariadb-alpine:tag` to use my
|
||||
registry instead.
|
||||
|
||||
### Run the image
|
||||
@@ -340,6 +341,12 @@ docker exec -it container_name /bin/sh -c 'exec mysql' < /local/path/mySQLdumps/
|
||||
docker exec -it container_name /bin/sh -c 'exec mysql -uroot -p"SuPeR$ecurEP@$$w0rd"' < /local/path/mySQLdumps/filename.sql
|
||||
```
|
||||
|
||||
## Healthcheck
|
||||
|
||||
Starting with internal version 2.0-10.6.4-r0, I've added a very basic healthcheck to the container. It simply checks that the mysqld daemon is running in the container and accepting connections. It **does NOT** check anything to do with the actual database. As such, you may want to override this with a more specific healthcheck for your particular use-case. If you just need to know MariaDB is actually running though, this healthcheck will work just fine.
|
||||
|
||||
If anyone has suggestions for a better healthcheck, PLEASE let me know!
|
||||
|
||||
## Source
|
||||
|
||||
The source for this container build (Dockerfile, entrypoint.sh) are available on my [private git repo](https://git.asifbacchus.app/ab-docker/mariadb-alpine) or on [GitHub](https://github.com/asifbacchus/ab-mariadb-alpine.git). Note that the newest versions will be on my repo and GitHub will be updated at most a few days later. Also, I'd prefer issues be filed on my repo, but I understand if GitHub is easier/more familiar for you.
|
||||
|
||||
+6
-6
@@ -86,7 +86,7 @@ if [ -z "$(ls -A /var/lib/mysql/ 2> /dev/null)" ]; then
|
||||
|
||||
# create system tables
|
||||
printf "DB-CREATE: Setting up mySQL system tables\n"
|
||||
if (! mysql_install_db --user=mysql --ldata=/var/lib/mysql > /dev/null); then
|
||||
if (! mariadb-install-db --user=mysql --ldata=/var/lib/mysql > /dev/null); then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@@ -113,7 +113,7 @@ if [ -z "$(ls -A /var/lib/mysql/ 2> /dev/null)" ]; then
|
||||
|
||||
# execute statements against mariadb and cleanup
|
||||
printf "DB-CREATE: Bootstrapping mySQL database\n"
|
||||
if (! mysqld --user=mysql --bootstrap --verbose=0 --skip-name-resolve --skip-networking=0 < "$sqlCmd"); then
|
||||
if (! mariadbd --user=mysql --bootstrap --verbose=0 --skip-name-resolve --skip-networking=0 < "$sqlCmd"); then
|
||||
exit 1
|
||||
fi
|
||||
shred -u "$sqlCmd"
|
||||
@@ -129,7 +129,7 @@ for f in /docker-entrypoint-initdb.d/*; do
|
||||
*.sql)
|
||||
if [ -s "$f" ]; then
|
||||
printf "IMPORT-SQL: Importing %s\n" "$f"
|
||||
if (! mysqld --user=mysql --bootstrap --verbose=0 --skip-name-resolve --skip-networking=0 < "$f"); then
|
||||
if (! mariadbd --user=mysql --bootstrap --verbose=0 --skip-name-resolve --skip-networking=0 < "$f"); then
|
||||
exit 3
|
||||
fi
|
||||
printf "\n"
|
||||
@@ -138,7 +138,7 @@ for f in /docker-entrypoint-initdb.d/*; do
|
||||
*.sql.gz)
|
||||
if [ -s "$f" ]; then
|
||||
printf "IMPORT-SQL: Importing %s\n" "$f"
|
||||
if (! gunzip -c "$f" | mysqld --user=mysql --bootstrap --verbose=0 --skip-name-resolve --skip-networking=0); then
|
||||
if (! gunzip -c "$f" | mariadbd --user=mysql --bootstrap --verbose=0 --skip-name-resolve --skip-networking=0); then
|
||||
exit 3
|
||||
fi
|
||||
printf "\n"
|
||||
@@ -168,8 +168,8 @@ fi
|
||||
# process CMD sent to this container
|
||||
case "$1" in
|
||||
-*)
|
||||
# param starts with '-' --> assume mysqld parameter(s) and append to CMD
|
||||
set -- /usr/bin/mysqld --user=mysql --console "$@"
|
||||
# param starts with '-' --> assume mariadbd parameter(s) and append to CMD
|
||||
set -- /usr/bin/mariadbd --user=mysql --console "$@"
|
||||
printf "\nExecuting: %s\n" "$*"
|
||||
exec "$@"
|
||||
;;
|
||||
|
||||
Reference in New Issue
Block a user