Ref: https://learn.cantrill.io/courses/docker-fundamentals/lectures/44660845 =OR= https://www.youtube.com/watch?v=fEACChbNoqk
GitHub: https://github.com/acantril/docker-fundamentals/blob/main/docker-container-environment-variables/instructions.md
KEY:value
docker run <imgID> -e KEY:value
“ENV”
“PATH”
→ indicates where the terminal opens & executes inside the containerRef: https://learn.cantrill.io/courses/docker-fundamentals/lectures/44660845 =OR= https://www.youtube.com/watch?v=fEACChbNoqk
GitHub: https://github.com/acantril/docker-fundamentals/blob/main/docker-container-environment-variables/instructions.md
💡 WordPress commonly used as example app for simple deployments
Run MariaDB for WordPress in a Docker container:
docker run \\
--name db \\
-e MYSQL_ROOT_PASSWORD=somewordpress \\
-e MYSQL_PASSWORD=wordpress \\
-e MYSQL_DATABASE=wordpress \\
-e MYSQL_USER=wordpress \\
-d \\
mariadb:10.6.4-focal \\
--default-authentication-plugin=mysql_native_password
Environment variables for configuring MariaDB:
MYSQL_ROOT_PASSWORD
sets the DB root passwordMYSQL_DATABASE
creates a DB with the name of the environment variableMYSQL_USER
creates a DB userMYSQL_PASSWORD
creates a password for the DB user❗ Storage of this MariaDB container is internal and ephemeral
With an additional container running a phpmyadmin
DB management app, we can connect to this MariaDB and store WordPress pages (check video for more details)