35 Commits

Author SHA1 Message Date
asif e6eedf5385 build(docker): Update build variables 2025-05-18 00:07:13 -06:00
asif def1d14534 chore(ide): Update VCS settings 2025-05-17 23:59:32 -06:00
asif 08c2608102 feat(mariadb): Update version to 11.4.5-r0 2025-05-17 23:58:05 -06:00
asif c415496f00 build(ide): Update docker build args 2025-01-24 01:56:26 -07:00
asif 8a6df0d489 refactor(entrypt): Use new executable names
Version 11 renames classic 'mysql' executable commands to 'mariadb' branded ones.
2025-01-24 01:47:52 -07:00
asif 4c98e019de build(ide): Update docker build args 2025-01-24 01:37:32 -07:00
asif 5b5109a0b8 feat(version): Update Alpine, mariadb version
Update Alpine to 3.21, mariadb to 11.4.4-r1
2025-01-24 01:34:59 -07:00
asif f0efa2b9fc build(ide): Update build configuration 2024-09-07 20:04:57 -06:00
asif 117a308944 feat(dockerfile): Update alpine and mariadb versions
Set to latest upstream source versions. Alpine 3.20 and MariaDB 10.11.8.
2024-09-07 20:01:55 -06:00
asif 49ec1145df build(docker): Update build config 2024-01-27 17:34:18 -07:00
asif 1e1fccea11 feat(dockerfile): Reduce healthcheck timeout
Reduce start period to 5s for faster dependency checks.
2024-01-27 17:31:15 -07:00
asif 2ef5cc7752 feat(dockerfile): Update base versions
Update base Alpine version to 3.19 and MariaDb to 10.11.6-r0
2024-01-27 17:30:23 -07:00
asif 222cc91646 chore(ide): update ide configs 2023-11-01 17:06:17 -06:00
asif a144f7ba10 feature(dockerfile): update alpine, mariadb version 2023-11-01 17:01:18 -06:00
asif 46bb4c0250 Update docker run configuration 2022-12-10 06:02:33 -07:00
asif 3a704c2d2b Update Alpine and MariaDB versions 2022-12-10 05:58:16 -07:00
asif 377a47c84c chore(ide): update docker build config 2022-02-19 08:33:17 -07:00
asif 7ad74a6828 chore(ide): docker build configuration for Rider 2022-02-19 08:31:15 -07:00
asif 277bff0c06 feature(Dockerfile): restructure and parameterize
- parameterize alpine and mariadb versions
- pin mariadb to at least specified version
- clean-up labels, add description
- move package update after installation
2022-02-19 08:26:29 -07:00
asif dd5db4ca01 feature(Dockerfile): add dockerignore 2022-02-19 08:19:07 -07:00
asif c1d15b5799 fix(dockerfile): update alpine base files
- resolve CVE-2021-3711, CVE-2021-3712
2021-09-07 04:14:49 -06:00
asif 0ed5cd76f6 docs(readme): update readme
- update TOC
- update and fix 'pull images' section
- add 'signed images' section with CodeNotary information
- add 'healthcheck' section
2021-09-07 03:43:38 -06:00
asif 6aae1c80e4 feature(dockerfile): add basic healthcheck
- check mysqld service only, not actual database
2021-09-07 03:06:20 -06:00
asif 1c5dc6cb12 feature(dockerfile): bump alpine base version
- also bumps MariaDB base version
2021-09-07 01:58:23 -06:00
asif ff53a85323 refactor(dockerfile): replace label-schema with opencontainers labels 2021-09-07 01:33:11 -06:00
asif fb0573cbae chore(git): update Rider IDE files, gitattributes, gitignore 2021-09-07 01:32:24 -06:00
Asif Bacchus 09752089d6 update labels, bump version number 2021-05-12 21:33:59 -06:00
Asif Bacchus e4ea780a12 fix(entrypoint): only show passwd if generated 2021-05-12 20:55:55 -06:00
Asif Bacchus 0fb3dd427c Revert "fix(entrypoint): fix missing db name for SQL import"
This reverts commit 1630094cf7.
2021-05-01 08:15:49 -06:00
Asif Bacchus 1630094cf7 fix(entrypoint): fix missing db name for SQL import 2021-05-01 07:56:44 -06:00
Asif Bacchus ee29f71ff0 chore: remove VSCode files 2021-05-01 07:00:15 -06:00
Asif Bacchus 7f930e17e7 feature: bump Alpine and MariaDB versions
- Alpine to 3.13
- MariaDB to 10.5.9
2021-05-01 06:59:20 -06:00
Asif Bacchus 2b7c54ead7 docs(README): fix wrong repo name 2021-01-05 16:49:31 -07:00
Asif Bacchus be539440e4 Merge remote-tracking branch 'origin/master'
# Conflicts:
#	README.md
2021-01-05 16:45:38 -07:00
Asif Bacchus 93b1212676 docs(README): use dockerhub as primary reference 2021-01-05 16:41:49 -07:00
19 changed files with 353 additions and 82 deletions
+3
View File
@@ -0,0 +1,3 @@
/**
!Dockerfile
!entrypoint.sh
+20 -2
View File
@@ -20,7 +20,7 @@
*.PDF diff=astextplain *.PDF diff=astextplain
*.rtf diff=astextplain *.rtf diff=astextplain
*.RTF diff=astextplain *.RTF diff=astextplain
*.md text *.md text diff=markdown
*.tex text diff=tex *.tex text diff=tex
*.adoc text *.adoc text
*.textile text *.textile text
@@ -30,6 +30,7 @@
*.tsv text *.tsv text
*.txt text *.txt text
*.sql text *.sql text
*.ps1 text eol=crlf
# Graphics # Graphics
*.png binary *.png binary
@@ -53,7 +54,23 @@
# These are explicitly windows files and should use crlf # These are explicitly windows files and should use crlf
*.bat text eol=crlf *.bat text eol=crlf
*.cmd 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 # Serialisation
*.json text *.json text
@@ -79,4 +96,5 @@
.gitattributes export-ignore .gitattributes export-ignore
.gitignore export-ignore .gitignore export-ignore
.gitkeep export-ignore .gitkeep export-ignore
.idea export-ignore
.vscode export-ignore .vscode export-ignore
+72 -10
View File
@@ -1,11 +1,73 @@
# VSCode files ### JetBrains template
.vscode/* # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
!.vscode/settings.json # Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
!.vscode/tasks.json
!.vscode/launch.json # User-specific stuff
!.vscode/extensions.json .idea/**/workspace.xml
!.vscode/numbered-bookmarks.json .idea/**/tasks.xml
*.code-workspace .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>
@@ -0,0 +1,20 @@
<?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="commitMessageValidationConfigOverride">
<CommitMessageValidationOverride>
<option name="enabled" value="true" />
</CommitMessageValidationOverride>
</option>
<option name="commitMessageValidationEnabledOverride">
<BoolValueOverride>
<option name="enabled" value="true" />
</BoolValueOverride>
</option>
</component>
</project>
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="ContentModelUserStore"> <component name="UserContentModel">
<attachedFolders /> <attachedFolders />
<explicitIncludes /> <explicitIncludes />
<explicitExcludes /> <explicitExcludes />
+9
View File
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="MarkdownSettings">
<enabledExtensions>
<entry key="MermaidLanguageExtension" value="false" />
<entry key="PlantUMLLanguageExtension" value="false" />
</enabledExtensions>
</component>
</project>
-7
View File
@@ -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>
+8
View File
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="GitCommitMessageStorage">
<option name="messageStorage">
<MessageStorage />
</option>
</component>
</project>
+6
View File
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="GitToolBoxBlameSettings">
<option name="version" value="2" />
</component>
</project>
+15
View File
@@ -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>
+8
View File
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="UserContentModel">
<attachedFolders />
<explicitIncludes />
<explicitExcludes />
</component>
</project>
+8
View File
@@ -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
View File
@@ -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>
+37
View File
@@ -0,0 +1,37 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Dockerfile" type="docker-deploy" factoryName="dockerfile" server-name="Docker (WSL)">
<deployment type="dockerfile">
<settings>
<option name="imageTag" value="docker.asifbacchus.dev/mariadb/ab-mariadb-alpine:11.4.5-r0" />
<option name="buildArgs">
<list>
<DockerEnvVarImpl>
<option name="name" value="ALPINE_VERSION" />
<option name="value" value="3.21" />
</DockerEnvVarImpl>
<DockerEnvVarImpl>
<option name="name" value="MARIADB_VERSION" />
<option name="value" value="11.4.5-r0" />
</DockerEnvVarImpl>
<DockerEnvVarImpl>
<option name="name" value="INTERNAL_VERSION" />
<option name="value" value="2.3.1" />
</DockerEnvVarImpl>
<DockerEnvVarImpl>
<option name="name" value="GIT_COMMIT" />
<option name="value" value="08c2608102" />
</DockerEnvVarImpl>
<DockerEnvVarImpl>
<option name="name" value="BUILD_DATE" />
<option name="value" value="2025-05-18" />
</DockerEnvVarImpl>
</list>
</option>
<option name="buildOnly" value="true" />
<option name="sourceFilePath" value="Dockerfile" />
</settings>
</deployment>
<EXTENSION ID="com.jetbrains.rider.docker.debug" isFastModeEnabled="true" isSslEnabled="false" />
<method v="2" />
</configuration>
</component>
-3
View File
@@ -1,3 +0,0 @@
{
"bookmarks": []
}
+42 -20
View File
@@ -1,26 +1,33 @@
# #
### mariadb running on Alpine Linux # mariadb running on Alpine Linux
# #
FROM alpine:3.12 # build arguments
ARG ALPINE_VERSION="3.21"
ARG MARIADB_VERSION="11.4.5-r0"
FROM alpine:${ALPINE_VERSION}
ARG ALPINE_VERSION
ARG MARIADB_VERSION
# standardized labels # standardized labels
LABEL maintainer="Asif Bacchus <asif@bacchus.cloud>" MAINTAINER Asif Bacchus <asif@asifbacchus.dev>
LABEL org.label-schema.cmd="docker run -d --name db -v volume:/var/lib/mysql [-v /pre/exec/scripts:/docker-entrypoint-preinit.d] [-v /sql/scripts:/docker-entrypoint-initdb.d] [-v /post/exec/scripts:/docker-entrypoint-postinit.d] [-e TZ=Etc/UTC -e MYSQL_UID=8100 -e MYSQL_GID=8100 -e MYSQL_ROOT_PASSWORD=... -e MYSQL_DATABASE='myData' -e MYSQL_CHARSET='utf8mb4' -e MYSQL_COLLATION='utf8mb4_general_ci' -e MYSQL_USER=... -e MYSQL_PASSWORD=...] docker.asifbacchus.app/mariadb/ab-mariadb-alpine:latest" LABEL dev.asifbacchus.docker.internalName="ab-mariadb-alpine"
LABEL org.label-schema.description="mariadb running on Alpine Linux." LABEL org.opencontainer.image.authors="Asif Bacchus <asif@asifbacchus.dev>"
LABEL org.label-schema.name="ab-mariadb-alpine" LABEL org.opencontainer.image.description="Mariadb on Alpine Linux."
LABEL org.label-schema.schema-version="1.0" LABEL org.opencontainer.image.documentation="https://git.asifbacchus.dev/ab-docker/ab-mariadb-alpine/raw/branch/main/README.md"
LABEL org.label-schema.url="https://git.asifbacchus.app/ab-docker/ab-mariadb-alpine" LABEL org.opencontainer.image.source="https://git.asifbacchus.dev/ab-docker/ab-mariadb-alpine.git"
LABEL org.label-schema.usage="https://git.asifbacchus.app/ab-docker/ab-mariadb-alpine/src/branch/master/README.md" LABEL org.opencontainer.image.title="ab-mariadb-alpine"
LABEL org.label-schema.vcs-url="https://git.asifbacchus.app/ab-docker/ab-mariadb-alpine.git" LABEL org.opencontainer.image.url="https://git.asifbacchus.dev/ab-docker/ab-mariadb-alpine"
LABEL org.opencontainer.image.vendor="Asif Bacchus <asif@asifbacchus.dev>"
# install mariadb and turn on TCP connection in default config # install mariadb and turn on TCP connection in default config
RUN apk --no-cache --repository=http://dl-cdn.alpinelinux.org/alpine/edge/main add \ RUN apk --update --no-cache add \
tzdata \ tzdata \
mariadb \ mariadb>${MARIADB_VERSION} \
mariadb-client \ mariadb-client>${MARIADB_VERSION} \
mariadb-server-utils \ mariadb-server-utils>${MARIADB_VERSION} \
&& rm -f /var/cache/apk/* \ && apk --no-cache --update upgrade \
&& sed -i 's/skip-networking/skip-networking=0/' /etc/my.cnf.d/mariadb-server.cnf && sed -i 's/skip-networking/skip-networking=0/' /etc/my.cnf.d/mariadb-server.cnf
# expose ports # expose ports
@@ -29,6 +36,14 @@ EXPOSE 3306
# create volume if user forgets # create volume if user forgets
VOLUME ["/var/lib/mysql"] 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 # set environment variables
ENV TZ=Etc/UTC ENV TZ=Etc/UTC
ENV MYSQL_UID=8100 ENV MYSQL_UID=8100
@@ -45,14 +60,21 @@ ENV MYSQL_PASSWORD=''
COPY entrypoint.sh /usr/local/bin/entrypoint.sh COPY entrypoint.sh /usr/local/bin/entrypoint.sh
RUN mkdir -p /docker-entrypoint-preinit.d \ RUN mkdir -p /docker-entrypoint-preinit.d \
&& mkdir -p /docker-entrypoint-initdb.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 # set entrypoint and default command
ENTRYPOINT [ "/usr/local/bin/entrypoint.sh" ] ENTRYPOINT [ "/usr/local/bin/entrypoint.sh" ]
CMD [ "/usr/bin/mysqld", "--user=mysql", "--console" ] CMD [ "/usr/bin/mysqld", "--user=mysql", "--console" ]
# add build date and version labels # add parameters, version and build date labels
# set build timestamp and version labels
ARG INTERNAL_VERSION
ARG GIT_COMMIT
ARG BUILD_DATE ARG BUILD_DATE
LABEL org.label-schema.build-date=${BUILD_DATE} LABEL dev.asifbacchus.docker.internalVersion=${INTERNAL_VERSION}
LABEL org.label-schema.vendor="mariaDB (10.5.8-r0)" LABEL org.opencontainers.image.version="${INTERNAL_VERSION}-${MARIADB_VERSION}"
LABEL org.label-schema.version="1.0" LABEL org.opencontainers.image.revision=${GIT_COMMIT}
LABEL org.opencontainers.image.created=${BUILD_DATE}
#EOF
+65 -27
View File
@@ -5,58 +5,90 @@ 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 adding a few extra ;-) Note that this container is built against the Alpine EDGE repository for newer versions of
mariaDB. mariaDB.
<!-- toc -->
- [Quick Start](#quick-start) - [Quick Start](#quick-start)
- [Pull the image](#pull-the-image) * [Pull the image](#pull-the-image)
- [Run the image](#run-the-image) + [Signed images](#signed-images)
- [Create a database](#create-a-database) * [Run the image](#run-the-image)
- [Root password](#root-password) * [Create a database](#create-a-database)
- [User password](#user-password) + [Root password](#root-password)
+ [User password](#user-password)
- [Connecting as a client](#connecting-as-a-client) - [Connecting as a client](#connecting-as-a-client)
- [Direct-to-Container](#direct-to-container) * [Direct-to-Container](#direct-to-container)
- [Separate Container](#separate-container) * [Separate Container](#separate-container)
- [Shell Access](#shell-access) - [Shell Access](#shell-access)
- [Checking Logs](#checking-logs) - [Checking Logs](#checking-logs)
- [Environment Variables](#environment-variables) - [Environment Variables](#environment-variables)
- [System-related](#system-related) * [System-related](#system-related)
- [MariaDB configuration](#mariadb-configuration) * [MariaDB configuration](#mariadb-configuration)
- [Database configuration](#database-configuration) * [Database configuration](#database-configuration)
- [Root Account](#root-account) - [Root Account](#root-account)
- [Integrated-account](#integrated-account) * [Integrated-account](#integrated-account)
- [Root-at-any-host](#root-at-any-host) * [Root-at-any-host](#root-at-any-host)
- [Data Persistence](#data-persistence) - [Data Persistence](#data-persistence)
- [Data instantiation/import](#data-instantiationimport) - [Data instantiation/import](#data-instantiationimport)
- [Existing DB (mysql directory)](#existing-db-mysql-directory) * [Existing DB (mysql directory)](#existing-db-mysql-directory)
- [Instantiation](#instantiation) * [Instantiation](#instantiation)
- [Custom Scripts](#custom-scripts) - [Custom Scripts](#custom-scripts)
- [Entrypoint Task Order](#entrypoint-task-order) * [Entrypoint Task Order](#entrypoint-task-order)
- [Custom Configuration](#custom-configuration) - [Custom Configuration](#custom-configuration)
- [Command-line parameters](#command-line-parameters) * [Command-line parameters](#command-line-parameters)
- [Configuration file(s)](#configuration-files) * [Configuration file(s)](#configuration-files)
- [Database dumps](#database-dumps) - [Database dumps](#database-dumps)
- [Healthcheck](#healthcheck)
- [Source](#source) - [Source](#source)
- [Final Thoughts](#final-thoughts) - [Final Thoughts](#final-thoughts)
<!-- tocstop -->
## Quick Start ## Quick Start
### Pull the image ### 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 The latest images are on my private docker registry. 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: days.
```bash ```bash
# my private repo # pull from my private repo
docker pull asifbacchus/ab-mariadb-alpine:latest docker pull docker.asifbacchus.dev/mariadb/ab-mariadb-alpine:latest
```
or # pull from dockerhub
```bash
# dockerhub
docker pull asifbacchus/ab-mariadb-alpine:latest docker pull asifbacchus/ab-mariadb-alpine:latest
``` ```
The examples in this document will refer to dockerhub, but know that anywhere you The examples in this document will refer to dockerhub, but know that anywhere you
see `asifbacchus/ab-mariadb-alpine:tag` you can use `asifbacchus/ab-mariadb-alpine:tag` to use my registry instead. see `asifbacchus/ab-mariadb-alpine:tag` you can use `docker.asifbacchus.app/mariadb/ab-mariadb-alpine:tag` to use my
registry instead.
#### Signed images
I have abandoned using Docker's signing mechanisms in favour of [CodeNotary](https://codenotary.io). Not only are they free, they offer several big advantages including avoiding Docker's weird and over-complicated key management system. The only drawback is that verifying images requires you downloading their [client software](https://github.com/codenotary/vcn/releases) which is free to use and does not require an account for verifying images or anything else. On Linux, you can simply rename the downloaded file `vcn` and place it somewhere in your path like `/usr/local/bin`, make it executable and then you can verify this image. Here's an example, obviously you need to modify it for your environment:
```sh
# run commands as root
sudo -s
# download vcn to proper location
wget https://github.com/vchain-us/vcn/releases/download/v0.9.9/vcn-v0.9.9-linux-amd64 -O /usr/local/bin/vcn
chmod +x /usr/local/bin/vcn
# make sure it works
vcn --version
# verify container image
vcn authenticate docker://asifbacchus/ab-mariadb-alpine:latest
```
If you want to confirm the image is authentic before each run, you can do:
```sh
vcn verify docker://asifbacchus/ab-mariadb-alpine:latest && docker run ... docker://asifbacchus/ab-mariadb-alpine:latest
```
Since you are making verification a prerequisite to running the docker command (i.e. using `&&`), you can be sure that you are working with a verified and signed image.
You can get more information on installing the client software for different platforms [here](https://docs.codenotary.io/guide/quickhelp.html#installing-the-codenotary-tools).
### Run the image ### Run the image
@@ -339,6 +371,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 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 ## 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. 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.
+10 -6
View File
@@ -19,6 +19,7 @@ isInt () {
# instantiate variables # instantiate variables
sqlCmd='/tmp/cmd.sql' sqlCmd='/tmp/cmd.sql'
showRootPassword=0
# convert env variables to uppercase for proper string comparison # convert env variables to uppercase for proper string comparison
MYSQL_SKIP_NAME_RESOLVE=$(convertCase "$MYSQL_SKIP_NAME_RESOLVE") MYSQL_SKIP_NAME_RESOLVE=$(convertCase "$MYSQL_SKIP_NAME_RESOLVE")
@@ -48,6 +49,7 @@ fi
if [ -z "$MYSQL_ROOT_PASSWORD" ]; then if [ -z "$MYSQL_ROOT_PASSWORD" ]; then
MYSQL_ROOT_PASSWORD="$( head /dev/urandom | tr -dc A-Za-z0-9 | head -c32 )" MYSQL_ROOT_PASSWORD="$( head /dev/urandom | tr -dc A-Za-z0-9 | head -c32 )"
export MYSQL_ROOT_PASSWORD=$MYSQL_ROOT_PASSWORD export MYSQL_ROOT_PASSWORD=$MYSQL_ROOT_PASSWORD
showRootPassword=1
fi fi
# change mysql UID & GID # change mysql UID & GID
@@ -84,7 +86,7 @@ if [ -z "$(ls -A /var/lib/mysql/ 2> /dev/null)" ]; then
# create system tables # create system tables
printf "DB-CREATE: Setting up mySQL system tables\n" 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 exit 1
fi fi
@@ -111,7 +113,7 @@ if [ -z "$(ls -A /var/lib/mysql/ 2> /dev/null)" ]; then
# execute statements against mariadb and cleanup # execute statements against mariadb and cleanup
printf "DB-CREATE: Bootstrapping mySQL database\n" 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 exit 1
fi fi
shred -u "$sqlCmd" shred -u "$sqlCmd"
@@ -127,7 +129,7 @@ for f in /docker-entrypoint-initdb.d/*; do
*.sql) *.sql)
if [ -s "$f" ]; then if [ -s "$f" ]; then
printf "IMPORT-SQL: Importing %s\n" "$f" 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 exit 3
fi fi
printf "\n" printf "\n"
@@ -136,7 +138,7 @@ for f in /docker-entrypoint-initdb.d/*; do
*.sql.gz) *.sql.gz)
if [ -s "$f" ]; then if [ -s "$f" ]; then
printf "IMPORT-SQL: Importing %s\n" "$f" 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 exit 3
fi fi
printf "\n" printf "\n"
@@ -159,13 +161,15 @@ done
# note initialization complete and display root password # note initialization complete and display root password
printf "\nInitialization complete...\n" printf "\nInitialization complete...\n"
if [ "$showRootPassword" -eq 1 ]; then
printf "(mySQL root password: %s)\n\n" "$MYSQL_ROOT_PASSWORD" printf "(mySQL root password: %s)\n\n" "$MYSQL_ROOT_PASSWORD"
fi
# process CMD sent to this container # process CMD sent to this container
case "$1" in case "$1" in
-*) -*)
# param starts with '-' --> assume mysqld parameter(s) and append to CMD # param starts with '-' --> assume mariadbd parameter(s) and append to CMD
set -- /usr/bin/mysqld --user=mysql --console "$@" set -- /usr/bin/mariadbd --user=mysql --console "$@"
printf "\nExecuting: %s\n" "$*" printf "\nExecuting: %s\n" "$*"
exec "$@" exec "$@"
;; ;;