You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: mariadb/content.md
+17-7Lines changed: 17 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -12,24 +12,34 @@ The %%IMAGE%% has a number of tags, and of note is `latest`, as the latest stabl
12
12
13
13
## Running the container
14
14
15
+
### Configuration
16
+
17
+
#### Port binding
18
+
19
+
By default, the database running within the container will listen on port 3306. You can expose the container port 3306 to the host port 3306 with the `-p 3306:3306` argument to `docker run`, like the command below:
20
+
21
+
```console
22
+
$ docker run --name some-%%REPO%% -p 3306:3306 %%IMAGE%%:latest
23
+
```
24
+
15
25
### Starting using a minimal configuration
16
26
17
27
The environment variables required to use this image involves the setting of the root user password:
18
28
19
29
```console
20
-
$ docker run --detach --name some-%%REPO%% --env MARIADB_ROOT_PASSWORD=my-secret-pw %%IMAGE%%:latest
30
+
$ docker run --detach --name some-%%REPO%% --env MARIADB_ROOT_PASSWORD=my-secret-pw %%IMAGE%%:latest
21
31
```
22
32
23
33
or:
24
34
25
35
```console
26
-
$ docker run --detach --name some-%%REPO%% --env MARIADB_ALLOW_EMPTY_ROOT_PASSWORD=1 %%IMAGE%%:latest
36
+
$ docker run --detach --name some-%%REPO%% --env MARIADB_ALLOW_EMPTY_ROOT_PASSWORD=1 %%IMAGE%%:latest
27
37
```
28
38
29
39
or:
30
40
31
41
```console
32
-
$ docker run --detach --name some-%%REPO%% --env MARIADB_RANDOM_ROOT_PASSWORD=1 %%IMAGE%%:latest
42
+
$ docker run --detach --name some-%%REPO%% --env MARIADB_RANDOM_ROOT_PASSWORD=1 %%IMAGE%%:latest
33
43
```
34
44
35
45
... where the container logs will contain the generated root password.
@@ -43,7 +53,7 @@ Run `docker compose up`, wait for it to initialize completely, and visit `http:/
43
53
Starting a MariaDB instance with a user, password, and a database:
... where `some-network` is a newly created network (other than `bridge` as the default network), `some-%%REPO%%` is the name you want to assign to your container, `my-secret-pw` is the password to be set for the MariaDB root user. See the list above for relevant tags to match your needs and environment. `some-application` and then environment variable `APP_DB_HOST`, `APP_DB_USER` and `APP_DB_PASSWD` are the application's configuration for its database connection.
The following command starts another `%%IMAGE%%` container instance and runs the `mariadb` command line client against your original `%%IMAGE%%` container, allowing you to execute SQL statements against your database instance:
0 commit comments