Skip to content

mcombeau/inception

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Inception

inception 42 project badge

A 42 project aimed at learning Docker and Docker-compose. This project asks us to create a small network of 3 Docker containers, one containing Nginx, one containing Wordpress and the third containing MariaDB. All three must work together over the Docker network to display a local website.

Status

Finished 06/10/2023. Grade: 100%

Usage

Launching this project requires a bit of setup:

  • Clone this repository and cd into it.
  • In the srcs folder, there is an ExampleEnvFile that must be filled out and saved into srcs/.env
  • The Makefile has a login variable that should be edited to reflect your 42 school login

Once these steps are complete, you can use make to build and launch the docker containers.

The website should be viewable at the adresses https://localhost or http://login.42.fr (replacing your login with the value in the Makefile variable).

Project Notes

Viewing Docker Images, Containers, Volumes and Networks

  • Show Docker images: docker images
  • Show Docker containers: docker ps (add -a option to view stopped/exited containers)
  • Show Docker volumes: docker volume ls (docker volume inspect <volume name> to view more information about the volume)
  • Show Docker networks: docker network ls

Useful Commands for Debugging Docker Containers

  • Show logs: docker-compose logs (add --follow <container name> option to only see that container's logs)
  • Run a container in interactive mode: docker run -it <image ID>
  • Execute a command inside a running container: docker exec <container name> <command>
  • Execute a command inside a running container in interactive mode: docker exec -it <container name> <command>
  • Execute an interactive shell inside a running container: docker exec -it <container name> sh (This shows that Docker containers are not secure, since we can easily get a shell as root)

Dockerfile Basic Commands

  • FROM: Downloads an image to use as the container's base. Here we are using Alpine:3.18.
  • RUN: Runs the specified command during the building process. Useful for installing binaries for later use.
  • COPY: Copy a file from host machine to the future docker container. Useful for loading custom configuration files.
  • EXPOSE: Expose a port so that it is accessible from outside the Docker network.
  • ENTRYPOINT [ "command", "args"]: The command to run at conainer startup.

Useful Resources

Docker:

Alpine Linux:

Nginx:

MariaDB:

WordPress:


Made by mcombeau: mcombeau@student.42.fr | LinkedIn: mcombeau | Website: codequoi.com

About

A 42 school project about Docker and Docker-Compose: create a small docker network with separate containers for NginX, Wordpress and MariaDB.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published