Giter Site home page Giter Site logo

mcombeau / inception Goto Github PK

View Code? Open in Web Editor NEW
2.0 1.0 0.0 43 KB

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

Home Page: https://www.codequoi.com/

Dockerfile 36.16% Shell 51.20% Makefile 12.64%
42-inception 42born2code 42cursus 42school configuration docker docker-compose dockerfile mariadb nginx wordpress

inception's Introduction

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: [email protected] | LinkedIn: mcombeau | Website: codequoi.com

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.