proofread and update some content/links

This commit is contained in:
Asif Bacchus 2020-11-28 07:49:33 -07:00
parent d877c16db4
commit aba9cee905
1 changed files with 18 additions and 11 deletions

View File

@ -25,10 +25,12 @@ Fully functional dockerized installation of MariaDB server and client running on
- [Existing DB (mysql directory)](#existing-db-mysql-directory)
- [Instantiation](#instantiation)
- [Custom Scripts](#custom-scripts)
- [Entrypoint Task Order](#entrypoint-task-order)
- [Custom Configuration](#custom-configuration)
- [Command-line parameters](#command-line-parameters)
- [Configuration file(s)](#configuration-files)
- [Database dumps](#database-dumps)
- [Source](#source)
- [Final Thoughts](#final-thoughts)
## Quick Start
@ -125,7 +127,7 @@ There are times where you will want to connect to your container and access the
docker exec -it container_name /bin/sh
```
Please note this is an *Alpine Linux* container so it uses the ASH shell. This is a POSIX-compliant shell that does not have the bells and whistles you may be used to in shells like BASH, etc. Also, Alpine uses BusyBox for most of its commands so some familiar Linux commands may not work as you are used to or may be entirely missing. I have, however, included *ping* since I find that a pretty essential tool when sorting out inter-container/container-host networking issues.
Please note this is an *Alpine Linux* container so it uses the ASH shell. This is a POSIX-compliant shell that does not have the bells and whistles you may be used to in shells like BASH, etc. Also, Alpine uses BusyBox for most of its commands so some familiar Linux commands may not work as you are used to or may be entirely missing. Notably, however, *ping* is installed and functional in this container.
## Checking Logs
@ -161,7 +163,7 @@ Most container configuration is accomplished via environment variables. We've al
|Variable|Default|Description|
|---|:---:|---|
MYSQL_SKIP_NAME_RESOLVE|TRUE|This will tell MariaDB NOT to run reverse DNS lookups on connecting hosts. As a result, user accounts should be defined by IP address versus hostname. This is the default setting for Docker containers. since their hostnames don't make much sense unless explicitly set. Setting this to 'FALSE' will allow you to use hostnames in user account definitions. [TRUE|FALSE]|
MYSQL_SKIP_NAME_RESOLVE|TRUE|This will tell MariaDB NOT to run reverse DNS lookups on connecting hosts. As a result, user accounts should be defined by IP address versus hostname. This is the default setting for Docker containers since hostnames are generally random and accounts are specified as 'user'@'%'. If you need to use hostnames, set this to 'FALSE' so you can use hostnames in account definitions.|
|MYSQL_CHARSET|utf8mb4|Character Set for the newly created database. Will NOT affect existing or imported databases.|
|MYSQL_COLLATION|utf8mb4_general_ci|Collation rules for the newly created database. Will NOT affect existing or imported databases.|
|MYSQL_ROOT_PASSWORD|auto-generated|Sets the *root* password for your MariaDB server. If you leave this blank (default) the container will generate a password for you and display it in the logs. In practice, you should really define this yourself. **This will be ignored if you are mounting a volume/directory with an existing database.** Please refer to the [Root Account](#root-account) section for some interesting notes.|
@ -188,7 +190,7 @@ The container creates a user *'root'@'%'* account using the password as set or a
## Data Persistence
By default, the container will create a volume to store your mySQL database so you don't accidentally lose any important information. In this case, the name is auto-generated by docker and is not very user-friendly. If, instead, you would like to use an existing volume, control the name of the created volume or use a bind-mount instead, then you can do so by specifying a mapping to */var/lib/mysql* in the container. For example:
By default, the container will create a volume to store your mySQL database so you don't accidentally lose any important information. In this case, the name is auto-generated by docker and is not very user-friendly. If, instead, you would like to use an existing volume, control the name of the created volume or use a bind-mount, you can do so by specifying a mapping to */var/lib/mysql* in the container. For example:
```bash
# create a volume or use an existing named-volume
@ -239,6 +241,8 @@ docker run -d \
docker.asifbacchus.app/mariadb/ab-mariadb-alpine
```
### Entrypoint Task Order
For reference, the sequence of events in the entrypoint script is:
1. Verify environment variables
@ -247,11 +251,11 @@ For reference, the sequence of events in the entrypoint script is:
4. **Execute pre-init scripts**
5. Create runtime PID file
6. Create database if one does not exist
a. Create system tables
b. Create database
c. Add root account and set permissions
d. Add user account if necessary
e. Drop default 'test' table
- Create system tables
- Create database
- Add root account and set permissions
- Add user account if necessary
- Drop default 'test' table
7. Import SQL files if they exist
8. **Execute post-init scripts**
9. Start *mysqld*
@ -292,7 +296,7 @@ docker run -d \
docker.asifbacchus.app/mariadb/ab-mariadb-alpine
```
You should be aware that the container passes *'--console --user=mysql'* command-line parameters to *mysql* 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:
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:
```bash
docker run -d \
@ -305,7 +309,7 @@ The above command would run the process forked into the background (why you woul
## Database dumps
This is exactly the same as the official container. I will repeat their instructions here for completeness:
This is exactly the same as the official container. I will repeat their instructions here for completeness and add a few more examples to make things clearer.
**Creating dumps** can be done using `docker exec` and will be written to the *host* machine. It is easiest to take advantage of root-integrated access for operations like this.
@ -330,6 +334,9 @@ 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
```
## 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/mariadb-alpine). 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.
## Final Thoughts
I hope this container is useful to you and helps you run a database where space 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 :-)