Docker infrastructure with NGINX, WordPress, and MariaDB, using Docker Compose and custom volumes. Includes dedicated containers and TLS security.
100/100
The Inception
project involves setting up a small infrastructure using Docker and Docker Compose within a Virtual Machine, with a focus on learning how to manage multiple services—such as NGINX, WordPress, and MariaDB—each running in dedicated containers, all orchestrated by Docker Compose.
srcs
directory.Makefile
is required at the root level to build and run the entire application.Dockerfile
.Alpine
or Debian
.pre-built
Docker images from Docker Hub.Infinite loops
or hacky patches in the entrypoint of the Dockerfile.passwords
or sensitive information
directly in Dockerfiles..env
file.Docker secrets
for managing sensitive data.login.42.fr
, pointing to your local IP
.443
.volumes
for WordPress files and database.To build and run the project, navigate to the root directory and run:
make
TLS/SSL:
openssl s_client -connect localhost:443
# Look in the output for the line with “Protocol” followed by the type of protocol used
# If you try any other port, the output should be an error
PORTS: nginx connects to wordpress via port 9000
docker exec -it nginx nc -zv wordpress 9000
# [SUCCESS MESSAGE]: Connection to wordpress (xxx.x.x.x) 9000 port [tcp/*] succeeded!
# [ERROR MESSAGE]: OCI runtime exec failed: exec failed: unable to start container process: exec: "nc"...
# If the error occurs, it means netcat isn't installed in the Docker container. To resolve this, run:
docker exec -it nginx bash
apt-get update && apt-get install -y netcat
docker exec -it nginx nc -zv wordpress 9000
exit
# Now, try the initial command again:
docker exec -it nginx nc -zv wordpress 9000
wordpress connects to mariadb via port 3306
docker exec -it wordpress nc -zv mariadb 3306
# [SUCCESS MESSAGE]: Connection to mariadb (xxx.x.x.x) 3306 port [tcp/mysql] succeeded!
# [ERROR MESSAGE]: OCI runtime exec failed: exec failed: unable to start container process: exec: "nc"...
# If the error occurs, it means netcat isn't installed in the Docker container. To resolve this, run:
docker exec -it wordpress bash
apt-get update && apt-get install -y netcat
docker exec -it wordpress nc -zv mariadb 3306
exit
# Now, try the initial command again:
docker exec -it wordpress nc -zv mariadb 3306
MARIADB:
docker exec -it mariadb bash
mariadb
SHOW DATABASES;
USE <database_name>;
SHOW TABLES;
SELECT * FROM <table_name>;
Grade | Lang | Type | Links and Subjects |
---|---|---|---|
⭐ | 🇺🇸 | 🔖 | Debian Versions |
✅ | 🇺🇸 | 📚 | Docker Concepts |
⭐⭐ | 🇺🇸 | 📄 | 42 Inception Guide - Part 1 |
⭐⭐ | 🇺🇸 | 📄 | 42 Inception Guide - Part 2 |
🤩 | 🇧🇷 | 📹 | Docker Essencial: Docker para Iniciantes |
⭐⭐ | 🇺🇸 | 📹 | Docker |
✅ OK | ⭐ Good | ⭐⭐ VeryGood | 🤩 Amazing | 🔖 Bookmarked2Read 📄 Blog | 💭 Chat | 📹 Video | 📚 Book & Scientific Papers