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/README.md
+17-7Lines changed: 17 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -81,24 +81,34 @@ The mariadb has a number of tags, and of note is `latest`, as the latest stable
81
81
82
82
## Running the container
83
83
84
+
### Configuration
85
+
86
+
#### Port binding
87
+
88
+
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:
89
+
90
+
```console
91
+
$ docker run --name some-mariadb -p 3306:3306 mariadb:latest
92
+
```
93
+
84
94
### Starting using a minimal configuration
85
95
86
96
The environment variables required to use this image involves the setting of the root user password:
87
97
88
98
```console
89
-
$ docker run --detach --name some-mariadb --env MARIADB_ROOT_PASSWORD=my-secret-pw mariadb:latest
99
+
$ docker run --detach --name some-mariadb --env MARIADB_ROOT_PASSWORD=my-secret-pw mariadb:latest
90
100
```
91
101
92
102
or:
93
103
94
104
```console
95
-
$ docker run --detach --name some-mariadb --env MARIADB_ALLOW_EMPTY_ROOT_PASSWORD=1 mariadb:latest
105
+
$ docker run --detach --name some-mariadb --env MARIADB_ALLOW_EMPTY_ROOT_PASSWORD=1 mariadb:latest
96
106
```
97
107
98
108
or:
99
109
100
110
```console
101
-
$ docker run --detach --name some-mariadb --env MARIADB_RANDOM_ROOT_PASSWORD=1 mariadb:latest
111
+
$ docker run --detach --name some-mariadb --env MARIADB_RANDOM_ROOT_PASSWORD=1 mariadb:latest
102
112
```
103
113
104
114
... where the container logs will contain the generated root password.
@@ -132,7 +142,7 @@ Run `docker compose up`, wait for it to initialize completely, and visit `http:/
132
142
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-mariadb` 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 `mariadb` container instance and runs the `mariadb` command line client against your original `mariadb` container, allowing you to execute SQL statements against your database instance:
0 commit comments