Compare commits
25 Commits
ed6e9cfe63
...
5-final
| Author | SHA1 | Date | |
|---|---|---|---|
| 2a5f5eb556 | |||
| af07af2015 | |||
| 3e4ea22d92 | |||
| 036cac764c | |||
| 442b3921b7 | |||
| f3627e136a | |||
| 8b3fc0886f | |||
| b9d8fa20c2 | |||
| 6bf6c283d7 | |||
| 09752089d6 | |||
| e4ea780a12 | |||
| 0fb3dd427c | |||
| 1630094cf7 | |||
| ee29f71ff0 | |||
| 7f930e17e7 | |||
| 2b7c54ead7 | |||
| be539440e4 | |||
| 93b1212676 | |||
| 402e5217a3 | |||
| 797777d547 | |||
| c689d210b9 | |||
| 086fdf8479 | |||
| f26ed38799 | |||
| 83d41efab1 | |||
| fc86b1c64b |
@@ -0,0 +1,3 @@
|
||||
/**
|
||||
!Dockerfile
|
||||
!entrypoint.sh
|
||||
+2
-1
@@ -1,3 +1,4 @@
|
||||
# VSCode files
|
||||
.vscode/*
|
||||
!.vscode/settings.json
|
||||
!.vscode/tasks.json
|
||||
@@ -7,4 +8,4 @@
|
||||
*.code-workspace
|
||||
|
||||
# Local History for Visual Studio Code
|
||||
.history/
|
||||
.history/
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
# Rider ignored files
|
||||
/projectSettingsUpdater.xml
|
||||
/contentModel.xml
|
||||
/modules.xml
|
||||
/.idea.ab-mariadb-alpine.iml
|
||||
# Datasource local storage ignored files
|
||||
/../../../../../../../../../:\Users\AsifB\Documents\RiderProjects\ab-mariadb-alpine\.idea\.idea.ab-mariadb-alpine.dir\.idea/dataSources/
|
||||
/dataSources.local.xml
|
||||
# Editor-based HTTP Client requests
|
||||
/httpRequests/
|
||||
@@ -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="commitMessageValidationConfigOverride">
|
||||
<CommitMessageValidationOverride>
|
||||
<option name="enabled" value="true" />
|
||||
</CommitMessageValidationOverride>
|
||||
</option>
|
||||
</component>
|
||||
</project>
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ContentModelUserStore">
|
||||
<component name="UserContentModel">
|
||||
<attachedFolders />
|
||||
<explicitIncludes />
|
||||
<explicitExcludes />
|
||||
@@ -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>
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
<?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="ERROR" enabled_by_default="true" />
|
||||
</profile>
|
||||
</component>
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
||||
@@ -1,8 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ContentModelStore">
|
||||
<e p="C:\Users\AsifB\AppData\Local\JetBrains\Rider2020.3\extResources" t="IncludeRecursive" />
|
||||
<e p="C:\Users\AsifB\AppData\Local\JetBrains\Rider2020.3\resharper-host\Local\Transient\Rider\v203\SolutionCaches\_.19.00" t="ExcludeRecursive" />
|
||||
<e p="C:\Users\AsifB\RiderProjects\mariadb-alpine" t="IncludeFlat" />
|
||||
</component>
|
||||
</project>
|
||||
@@ -1,8 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/.idea/.idea.mariadb-alpine.dir/.idea/riderModule.iml" filepath="$PROJECT_DIR$/.idea/.idea.mariadb-alpine.dir/.idea/riderModule.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
||||
@@ -1,6 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="RiderProjectSettingsUpdater">
|
||||
<option name="vcsConfiguration" value="2" />
|
||||
</component>
|
||||
</project>
|
||||
-6
@@ -1,6 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
||||
-123
@@ -1,123 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="114c4900-1ad3-480d-a423-ea02ef8f6005" name="Default Changelist" comment="" />
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
||||
<option name="LAST_RESOLUTION" value="IGNORE" />
|
||||
</component>
|
||||
<component name="Git.Settings">
|
||||
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
|
||||
</component>
|
||||
<component name="GitToolBoxStore">
|
||||
<option name="projectConfigVersion" value="2" />
|
||||
</component>
|
||||
<component name="IdeDocumentHistory">
|
||||
<changedPaths>
|
||||
<option value="$PROJECT_DIR$/entrypoint.sh" />
|
||||
<option value="$PROJECT_DIR$/Dockerfile" />
|
||||
</changedPaths>
|
||||
</component>
|
||||
<component name="ProjectId" id="1mEUx5cS7E0AfMFfANhfLJYwTfS" />
|
||||
<component name="ProjectLevelVcsManager" settingsEditedManually="true" />
|
||||
<component name="ProjectViewState">
|
||||
<option name="autoscrollToSource" value="true" />
|
||||
<option name="hideEmptyMiddlePackages" value="true" />
|
||||
<option name="showLibraryContents" value="true" />
|
||||
</component>
|
||||
<component name="PropertiesComponent">
|
||||
<property name="RunOnceActivity.OpenProjectViewOnStart" value="true" />
|
||||
<property name="RunOnceActivity.ShowReadmeOnStart" value="true" />
|
||||
<property name="node.js.detected.package.eslint" value="true" />
|
||||
<property name="node.js.detected.package.tslint" value="true" />
|
||||
<property name="node.js.path.for.package.eslint" value="project" />
|
||||
<property name="node.js.path.for.package.tslint" value="project" />
|
||||
<property name="node.js.selected.package.eslint" value="(autodetect)" />
|
||||
<property name="node.js.selected.package.tslint" value="(autodetect)" />
|
||||
<property name="nodejs_package_manager_path" value="npm" />
|
||||
<property name="settings.editor.selected.configurable" value="preferences.pluginManager" />
|
||||
<property name="vue.rearranger.settings.migration" value="true" />
|
||||
</component>
|
||||
<component name="RunManager">
|
||||
<configuration name="Docker Image" type="docker-deploy" factoryName="docker-image" temporary="true" server-name="Docker">
|
||||
<deployment type="docker-image">
|
||||
<settings>
|
||||
<option name="imageTag" value="docker.asifbacchus.app/mariadb/mariadb-alpine:10.5" />
|
||||
<option name="command" value="" />
|
||||
<option name="containerName" value="db" />
|
||||
<option name="entrypoint" value="" />
|
||||
<option name="commandLineOptions" value="--rm" />
|
||||
</settings>
|
||||
</deployment>
|
||||
<method v="2" />
|
||||
</configuration>
|
||||
<recent_temporary>
|
||||
<list>
|
||||
<item itemvalue="Docker.Docker Image" />
|
||||
</list>
|
||||
</recent_temporary>
|
||||
</component>
|
||||
<component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
|
||||
<component name="TaskManager">
|
||||
<task active="true" id="Default" summary="Default task">
|
||||
<changelist id="114c4900-1ad3-480d-a423-ea02ef8f6005" name="Default Changelist" comment="" />
|
||||
<created>1609058490002</created>
|
||||
<option name="number" value="Default" />
|
||||
<option name="presentableId" value="Default" />
|
||||
<updated>1609058490002</updated>
|
||||
<workItem from="1609058494288" duration="604000" />
|
||||
<workItem from="1609059119559" duration="214000" />
|
||||
<workItem from="1609059354834" duration="7502000" />
|
||||
</task>
|
||||
<task id="LOCAL-00001" summary="build: Rider project config files">
|
||||
<created>1609059462884</created>
|
||||
<option name="number" value="00001" />
|
||||
<option name="presentableId" value="LOCAL-00001" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1609059462884</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00002" summary="feature(DOCKERFILE): use edge repo - change alpine repo to EDGE so latest versions can be used - update mariaDB minor version">
|
||||
<created>1609067290388</created>
|
||||
<option name="number" value="00002" />
|
||||
<option name="presentableId" value="LOCAL-00002" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1609067290388</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00003" summary="fix: chown files in entrypoint vs dockerfile - init directories chown'd in entrypoint vs dockerfile - sets proper UID and GID instead of system default">
|
||||
<created>1609067732307</created>
|
||||
<option name="number" value="00003" />
|
||||
<option name="presentableId" value="LOCAL-00003" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1609067732307</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="4" />
|
||||
<servers />
|
||||
</component>
|
||||
<component name="TypeScriptGeneratedFilesManager">
|
||||
<option name="version" value="3" />
|
||||
</component>
|
||||
<component name="Vcs.Log.Tabs.Properties">
|
||||
<option name="TAB_STATES">
|
||||
<map>
|
||||
<entry key="MAIN">
|
||||
<value>
|
||||
<State />
|
||||
</value>
|
||||
</entry>
|
||||
</map>
|
||||
</option>
|
||||
<option name="oldMeFiltersMigrated" value="true" />
|
||||
</component>
|
||||
<component name="VcsManagerConfiguration">
|
||||
<option name="CLEAR_INITIAL_COMMIT_MESSAGE" value="true" />
|
||||
<MESSAGE value="build: Rider project config files" />
|
||||
<MESSAGE value="feature(DOCKERFILE): use edge repo - change alpine repo to EDGE so latest versions can be used - update mariaDB minor version" />
|
||||
<MESSAGE value="fix: chown files in entrypoint vs dockerfile - init directories chown'd in entrypoint vs dockerfile - sets proper UID and GID instead of system default" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="fix: chown files in entrypoint vs dockerfile - init directories chown'd in entrypoint vs dockerfile - sets proper UID and GID instead of system default" />
|
||||
</component>
|
||||
<component name="XSLT-Support.FileAssociations.UIState">
|
||||
<expand />
|
||||
<select />
|
||||
</component>
|
||||
</project>
|
||||
@@ -0,0 +1,28 @@
|
||||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="Dockerfile" type="docker-deploy" factoryName="dockerfile" server-name="Docker LOCAL">
|
||||
<deployment type="dockerfile">
|
||||
<settings>
|
||||
<option name="imageTag" value="docker.asifbacchus.dev/mariadb/ab-mariadb-alpine:10.5.13" />
|
||||
<option name="buildArgs">
|
||||
<list>
|
||||
<DockerEnvVarImpl>
|
||||
<option name="name" value="INTERNAL_VERSION" />
|
||||
<option name="value" value="1.2" />
|
||||
</DockerEnvVarImpl>
|
||||
<DockerEnvVarImpl>
|
||||
<option name="name" value="GIT_COMMIT" />
|
||||
<option name="value" value="af07af2015" />
|
||||
</DockerEnvVarImpl>
|
||||
<DockerEnvVarImpl>
|
||||
<option name="name" value="BUILD_DATE" />
|
||||
<option name="value" value="2022-02-19" />
|
||||
</DockerEnvVarImpl>
|
||||
</list>
|
||||
</option>
|
||||
<option name="buildOnly" value="true" />
|
||||
<option name="sourceFilePath" value="Dockerfile" />
|
||||
</settings>
|
||||
</deployment>
|
||||
<method v="2" />
|
||||
</configuration>
|
||||
</component>
|
||||
Vendored
-3
@@ -1,3 +0,0 @@
|
||||
{
|
||||
"bookmarks": []
|
||||
}
|
||||
+31
-19
@@ -1,26 +1,33 @@
|
||||
#
|
||||
### mariadb running on Alpine Linux
|
||||
# mariadb running on Alpine Linux
|
||||
#
|
||||
|
||||
FROM alpine:3.12
|
||||
# version arguments
|
||||
ARG ALPINE_VERSION="3.14"
|
||||
ARG MARIADB_VERSION="10.5.13-r0"
|
||||
|
||||
FROM alpine:${ALPINE_VERSION}
|
||||
ARG ALPINE_VERSION
|
||||
ARG MARIADB_VERSION
|
||||
|
||||
# standardized labels
|
||||
LABEL maintainer="Asif Bacchus <asif@bacchus.cloud>"
|
||||
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 org.label-schema.description="mariadb running on Alpine Linux."
|
||||
LABEL org.label-schema.name="ab-mariadb-alpine"
|
||||
LABEL org.label-schema.schema-version="1.0"
|
||||
LABEL org.label-schema.url="https://git.asifbacchus.app/ab-docker/mariadb-alpine"
|
||||
LABEL org.label-schema.usage="https://git.asifbacchus.app/ab-docker/mariadb-alpine/wiki"
|
||||
LABEL org.label-schema.vcs-url="https://git.asifbacchus.app/ab-docker/mariadb-alpine.git"
|
||||
MAINTAINER Asif Bacchus <asif@asifbacchus.dev>
|
||||
LABEL dev.asifbacchus.docker.internalName="ab-mariadb-alpine"
|
||||
LABEL org.opencontainer.image.authors="Asif Bacchus <asif@asifbacchus.dev>"
|
||||
LABEL org.opencontainer.image.description="Mariadb on Alpine Linux."
|
||||
LABEL org.opencontainer.image.documentation="https://git.asifbacchus.dev/ab-docker/ab-mariadb-alpine/raw/branch/main/README.md"
|
||||
LABEL org.opencontainer.image.source="https://git.asifbacchus.dev/ab-docker/ab-mariadb-alpine.git"
|
||||
LABEL org.opencontainer.image.title="ab-mariadb-alpine"
|
||||
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
|
||||
RUN apk --no-cache --repository=http://dl-cdn.alpinelinux.org/alpine/edge/main add \
|
||||
RUN apk --no-cache --update add \
|
||||
tzdata \
|
||||
mariadb \
|
||||
mariadb-client \
|
||||
mariadb-server-utils \
|
||||
&& rm -f /var/cache/apk/* \
|
||||
mariadb>${MARIADB_VERSION} \
|
||||
mariadb-client>${MARIADB_VERSION} \
|
||||
mariadb-server-utils>${MARIADB_VERSION} \
|
||||
&& apk --no-cache --update upgrade \
|
||||
&& sed -i 's/skip-networking/skip-networking=0/' /etc/my.cnf.d/mariadb-server.cnf
|
||||
|
||||
# expose ports
|
||||
@@ -51,8 +58,13 @@ RUN mkdir -p /docker-entrypoint-preinit.d \
|
||||
ENTRYPOINT [ "/usr/local/bin/entrypoint.sh" ]
|
||||
CMD [ "/usr/bin/mysqld", "--user=mysql", "--console" ]
|
||||
|
||||
# add build date and version labels
|
||||
# set build timestamp and version labels
|
||||
ARG INTERNAL_VERSION
|
||||
ARG GIT_COMMIT
|
||||
ARG BUILD_DATE
|
||||
LABEL org.label-schema.build-date=${BUILD_DATE}
|
||||
LABEL org.label-schema.vendor="mariaDB (10.5.8-r0)"
|
||||
LABEL org.label-schema.version="1.0"
|
||||
LABEL dev.asifbacchus.docker.internalVersion=${INTERNAL_VERSION}
|
||||
LABEL org.opencontainers.image.version="${INTERNAL_VERSION}-${MARIADB_VERSION}"
|
||||
LABEL org.opencontainers.image.revision=${GIT_COMMIT}
|
||||
LABEL org.opencontainers.image.created=${BUILD_DATE}
|
||||
|
||||
#EOF
|
||||
@@ -1,6 +1,9 @@
|
||||
# MariaDB on Alpine Linux (dockerized)
|
||||
|
||||
Fully functional dockerized installation of MariaDB server and client running on Alpine Linux. This container is roughly half the size of the official MariaDB container which runs on Ubuntu but still aims to mimic all its features while adding a few extra ;-)
|
||||
Fully functional dockerized installation of MariaDB server and client running on Alpine Linux. This container is roughly
|
||||
half the size of the official MariaDB container which runs on Ubuntu but still aims to mimic all its features while
|
||||
adding a few extra ;-) Note that this container is built against the Alpine EDGE repository for newer versions of
|
||||
mariaDB.
|
||||
|
||||
- [Quick Start](#quick-start)
|
||||
- [Pull the image](#pull-the-image)
|
||||
@@ -37,11 +40,12 @@ Fully functional dockerized installation of MariaDB server and client running on
|
||||
|
||||
### Pull the image
|
||||
|
||||
The latest images are on my private Docker Repo but I also try to keep the ones on Dockerhub updated within a few days. As such, you have two choices:
|
||||
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:
|
||||
|
||||
```bash
|
||||
# my private repo
|
||||
docker pull docker.asifbacchus.app/mariadb/ab-mariadb-alpine:latest
|
||||
docker pull asifbacchus/ab-mariadb-alpine:latest
|
||||
```
|
||||
|
||||
or
|
||||
@@ -51,7 +55,9 @@ or
|
||||
docker pull asifbacchus/ab-mariadb-alpine:latest
|
||||
```
|
||||
|
||||
All the examples in this document will refer to my repo, but you can use Dockerhub if you prefer.
|
||||
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
|
||||
registry instead.
|
||||
|
||||
### Run the image
|
||||
|
||||
@@ -64,7 +70,7 @@ docker run -d \
|
||||
-e MYSQL_DATABASE='CompanyX' \
|
||||
-e MYSQL_USER='JaneDoe' \
|
||||
-e MYSQL_PASSWORD='JanesPa$$w0rd' \
|
||||
docker.asifbacchus.app/mariadb/ab-mariadb-alpine
|
||||
asifbacchus/ab-mariadb-alpine
|
||||
```
|
||||
|
||||
Let's take a quick overview of the options used above:
|
||||
@@ -74,7 +80,7 @@ Let's take a quick overview of the options used above:
|
||||
Assuming an existing database does not exist in the container's data directory already, it will create an empty database for you. The name of this database is controlled by the environment variable `MYSQL_DATABASE`. This defaults to 'myData'. If you would like to create a database called 'CompanyX', for example, you would set the environment variable as follows:
|
||||
|
||||
```bash
|
||||
docker run -d -e MYSQL_DATABASE='CompanyX' docker.asifbacchus.app/mariadb/ab-mariadb-alpine
|
||||
docker run -d -e MYSQL_DATABASE='CompanyX' asifbacchus/ab-mariadb-alpine
|
||||
```
|
||||
|
||||
#### Root password
|
||||
@@ -84,7 +90,7 @@ If you do not set a root password for mySQL, the container will generate one for
|
||||
In normal usage, you will want to set the root password instead of having it generated for you. This is accomplished by setting the environment variable `MYSQL_ROOT_PASSWORD`. The command would look something like:
|
||||
|
||||
```bash
|
||||
docker run -d -e MYSQL_ROOT_PASSWORD='SuPeR$ecurEP@$$w0rd' docker.asifbacchus.app/mariadb/ab-mariadb-alpine
|
||||
docker run -d -e MYSQL_ROOT_PASSWORD='SuPeR$ecurEP@$$w0rd' asifbacchus/ab-mariadb-alpine
|
||||
```
|
||||
|
||||
#### User password
|
||||
@@ -92,7 +98,7 @@ docker run -d -e MYSQL_ROOT_PASSWORD='SuPeR$ecurEP@$$w0rd' docker.asifbacchus.ap
|
||||
If you would like a user account created for you with FULL privileges to the database created by the container, you must set two environment variables: `MYSQL_USER` and `MYSQL_PASSWORD`. You can do that as follows:
|
||||
|
||||
```bash
|
||||
docker run -d -e MYSQL_USER='JaneDoe' -e MYSQL_PASSWORD='JanesPa$$w0rd' docker.asifbacchus.app/mariadb/ab-mariadb-alpine
|
||||
docker run -d -e MYSQL_USER='JaneDoe' -e MYSQL_PASSWORD='JanesPa$$w0rd' asifbacchus/ab-mariadb-alpine
|
||||
```
|
||||
|
||||
## Connecting as a client
|
||||
@@ -114,7 +120,7 @@ This will log you into the container using the root account and connect you to M
|
||||
You can launch another instance of the container and use that as a client to connect to your server container or any other remote MariaDB/mySQL instance. In this case, we don't want to pass any environment variables, but we want to pass a separate CMD parameter as follows:
|
||||
|
||||
```bash
|
||||
docker run -it --rm docker.asifbacchus.app/mariadb/ab-mariadb-alpine mysql -hmysql.host.tld -uusername -ppassword
|
||||
docker run -it --rm asifbacchus/ab-mariadb-alpine mysql -hmysql.host.tld -uusername -ppassword
|
||||
```
|
||||
|
||||
**N.B.* I used the `--rm` Docker parameter to automatically remove the container on exit. This is optional.
|
||||
@@ -194,10 +200,10 @@ By default, the container will create a volume to store your mySQL database so y
|
||||
|
||||
```bash
|
||||
# create a volume or use an existing named-volume
|
||||
docker run -d -v mydatabase:/var/lib/mysql docker.asifbacchus.app/mariadb/ab-mariadb-alpine
|
||||
docker run -d -v mydatabase:/var/lib/mysql asifbacchus/ab-mariadb-alpine
|
||||
|
||||
# use a bind-mount location
|
||||
docker run -d -v /my/local/dir:/var/lib/mysql docker.asifbacchus.app/mariadb/ab-mariadb-alpine
|
||||
docker run -d -v /my/local/dir:/var/lib/mysql asifbacchus/ab-mariadb-alpine
|
||||
```
|
||||
|
||||
## Data instantiation/import
|
||||
@@ -207,7 +213,7 @@ docker run -d -v /my/local/dir:/var/lib/mysql docker.asifbacchus.app/mariadb/ab-
|
||||
The entrypoint script of the container simply checks to see if the */var/lib/mysql* directory is empty and, if so, creates a new database for you. Thus, if you want to import an existing database, you simply have to mount a valid *mysql* subdirectory:
|
||||
|
||||
```bash
|
||||
docker run -d -v /existing/mysql:/var/lib/mysql docker.asifbacchus.app/mariadb/ab-mariadb-alpine
|
||||
docker run -d -v /existing/mysql:/var/lib/mysql asifbacchus/ab-mariadb-alpine
|
||||
```
|
||||
|
||||
### Instantiation
|
||||
@@ -215,13 +221,13 @@ docker run -d -v /existing/mysql:/var/lib/mysql docker.asifbacchus.app/mariadb/a
|
||||
If you want to 'instantiate' your newly created database (add tables, some default data, set privileges, etc.) then you can import SQL files with commands preloaded. Any *.sql* or *.sql.gz* files mounted in the container's */docker-entrypoint-initdb.d* folder will be imported after the new database is created.
|
||||
|
||||
```bash
|
||||
docker run -d -v /sql/import/scripts:/docker-entrypoint-initdb.d docker.asifbacchus.app/mariadb/ab-mariadb-alpine
|
||||
docker run -d -v /sql/import/scripts:/docker-entrypoint-initdb.d asifbacchus/ab-mariadb-alpine
|
||||
```
|
||||
|
||||
You should review the logs when doing this to see if MariaDB throws any errors due to syntax errors or other mistakes in your SQL files. An easy way to do this is:
|
||||
|
||||
```bash
|
||||
docker run -d --name db -v /sql/import/scripts:/docker-entrypoint-initdb.d docker.asifbacchus.app/mariadb/ab-mariadb-alpine && docker logs -f db
|
||||
docker run -d --name db -v /sql/import/scripts:/docker-entrypoint-initdb.d asifbacchus/ab-mariadb-alpine && docker logs -f db
|
||||
```
|
||||
|
||||
You can, of course, name your container anything you like. Just change *'db'* in both places to whatever you choose.
|
||||
@@ -238,7 +244,7 @@ To run scripts after MariaDB is initialized (i.e. after a database is created an
|
||||
docker run -d \
|
||||
-v /my/pre-init/scripts:/docker-entrypoint-preinit.d \
|
||||
-v /my/post-init/scripts:/docker-entrypoint-postinit.d \
|
||||
docker.asifbacchus.app/mariadb/ab-mariadb-alpine
|
||||
asifbacchus/ab-mariadb-alpine
|
||||
```
|
||||
|
||||
### Entrypoint Task Order
|
||||
@@ -267,7 +273,7 @@ For reference, the sequence of events in the entrypoint script is:
|
||||
You can pass MariaDB command-line parameters to your container just as your would with a regular *mysqld* instance. For example:
|
||||
|
||||
```bash
|
||||
docker run -d docker.asifbacchus.app/mariadb/ab-mariadb-alpine --innodb-ft-min-token-size=2
|
||||
docker run -d asifbacchus/ab-mariadb-alpine --innodb-ft-min-token-size=2
|
||||
```
|
||||
|
||||
The container will concatenate any parameters your supply with the default ones of *--console --user=mysql*. Note that command-line parameters override environment variable parameters supplied to the container.
|
||||
@@ -280,12 +286,12 @@ If you would like to use a completely custom MariaDB configuration you will need
|
||||
# custom my.cnf
|
||||
docker run -d \
|
||||
-v /mysql/configuration/my.cnf:/etc/my.cnf \
|
||||
docker.asifbacchus.app/mariadb/ab-mariadb-alpine
|
||||
asifbacchus/ab-mariadb-alpine
|
||||
|
||||
# custom server-related files
|
||||
docker run -d \
|
||||
-v /mysql/server-config:/etc/my.cnf.d \
|
||||
docker.asifbacchus.app/mariadb/ab-mariadb-alpine
|
||||
asifbacchus/ab-mariadb-alpine
|
||||
|
||||
# complex configuration using custom my.cnf
|
||||
# this completely depends on how you specify things in my.cnf
|
||||
@@ -293,7 +299,7 @@ docker run -d \
|
||||
-v /mysql/config/my.cnf:/etc/my.cnf \
|
||||
-v /mysql/other-config:/etc/mysql/some-directory \
|
||||
-v /mysql/more-configs:/etc/mysql/cnf/another-dir \
|
||||
docker.asifbacchus.app/mariadb/ab-mariadb-alpine
|
||||
asifbacchus/ab-mariadb-alpine
|
||||
```
|
||||
|
||||
You should be aware that the container passes *'--console --user=mysql'* command-line parameters to *mysqld* by default and that will override parameters specified in *my.cnf* or any other configuration file. If you need to override these defaults, you will have to pass the *mysqld* command manually:
|
||||
@@ -301,7 +307,7 @@ You should be aware that the container passes *'--console --user=mysql'* command
|
||||
```bash
|
||||
docker run -d \
|
||||
-v /mysql/configuration/my.cnf:/etc/my.cnf \
|
||||
docker.asifbacchus.app/mariadb/ab-mariadb-alpine \
|
||||
asifbacchus/ab-mariadb-alpine \
|
||||
mysqld --user=anotheruser
|
||||
```
|
||||
|
||||
@@ -340,4 +346,4 @@ The source for this container build (Dockerfile, entrypoint.sh) are available on
|
||||
|
||||
## Final Thoughts
|
||||
|
||||
I hope this container is useful to you and helps you run a database where memory may be at a premium. I do my best to make sure everything runs properly and as much like the official container as possible. If you find any bugs, implementation issues or have any suggestions, please file an issue and let me know! I am *NOT* affiliated with MariaDB in any way and this container is strictly my implementation of their software. Please **do not** bother them with any issues you have with this container, let me know instead! Happy dockerizing :-)
|
||||
I hope this container is useful to you and helps you run a database where memory may be at a premium. I do my best to make sure everything runs properly and as much like the official container as possible. If you find any bugs, implementation issues or have any suggestions, please file an issue and let me know! I am *NOT* affiliated with MariaDB in any way and this container is strictly my implementation of their software. Please **do not** bother them with any issues you have with this container, let me know instead! Happy dockerizing :-)
|
||||
+5
-1
@@ -19,6 +19,7 @@ isInt () {
|
||||
|
||||
# instantiate variables
|
||||
sqlCmd='/tmp/cmd.sql'
|
||||
showRootPassword=0
|
||||
|
||||
# convert env variables to uppercase for proper string comparison
|
||||
MYSQL_SKIP_NAME_RESOLVE=$(convertCase "$MYSQL_SKIP_NAME_RESOLVE")
|
||||
@@ -48,6 +49,7 @@ fi
|
||||
if [ -z "$MYSQL_ROOT_PASSWORD" ]; then
|
||||
MYSQL_ROOT_PASSWORD="$( head /dev/urandom | tr -dc A-Za-z0-9 | head -c32 )"
|
||||
export MYSQL_ROOT_PASSWORD=$MYSQL_ROOT_PASSWORD
|
||||
showRootPassword=1
|
||||
fi
|
||||
|
||||
# change mysql UID & GID
|
||||
@@ -159,7 +161,9 @@ done
|
||||
|
||||
# note initialization complete and display root password
|
||||
printf "\nInitialization complete...\n"
|
||||
printf "(mySQL root password: %s)\n\n" "$MYSQL_ROOT_PASSWORD"
|
||||
if [ "$showRootPassword" -eq 1 ]; then
|
||||
printf "(mySQL root password: %s)\n\n" "$MYSQL_ROOT_PASSWORD"
|
||||
fi
|
||||
|
||||
# process CMD sent to this container
|
||||
case "$1" in
|
||||
|
||||
Reference in New Issue
Block a user