Complete containerized web infrastructure using Docker. Sets up a secure WordPress website with NGINX reverse proxy, MariaDB database, and SSL encryption. All services run in separate containers with custom Dockerfiles.
Config Nginx:
https://www.digitalocean.com/community/tutorials/understanding-nginx-server-and-location-block-selection-algorithms
https://www.digitalocean.com/community/tutorials/understanding-and-implementing-fastcgi-proxying-in-nginx
Dl le script d'installation:
curl -fsSL https://get.docker.com -o get-docker.sh
sh get-docker.sh
dockerd-rootless-setuptool.sh installRun son image sans docker compose:
Build l'image:
docker build -t mon_image .- "-t mon_image" Assigne un nom / un tag
- "." Specifie le repertoire ou est le Dockerfile
Lancer le conteneur a partir de l'image:
docker run -d -p 443:443 --name mon_docker mon_image- "-d" flag pour executer en arriere plan
- "-p 443:443" mappe les ports 443 host vers 443 du container
- "--name mon_docker" nom du container/docker
- "mon_image" nom de l'image qu'on a build juste avant
Lister les conteneurs actifs:
docker psAcceder aux logs du contenur:
docker logs mon_conteneurAcceder aux conteneur en bash:
docker exec -it mon_conteneur bash(nginx -t direct dans le docker pour voir les problemes de conf)
Arreter le conteneur
docker stop mon_conteneurSupprimer le conteneur:
docker rm mon_conteneurTest redis:
docker exec -it redis redis-cli
PING
SET test_key "hello"
GET test_key
INFOPar defaut les ports en dessous de 1024 necessite des privileges superieur :
Error response from daemon: driver failed programming external connectivity on endpoint cadvisor (ac77633a8a49e579f23141f4f2f661c6bcfb0b49d048c72d34152ec8b566f371): failed to bind port 0.0.0.0:8080/tcp: Error starting userland proxy: listen tcp4 0.0.0.0:8080: bind: address already in use
make: *** [Makefile:8: up] Error 1La solution (la plus simple mais pas la meilleure):
echo "net.ipv4.ip_unprivileged_port_start=80" | sudo tee -a /etc/sysctl.conf
sudo sysctl -p