{"id":21031953,"url":"https://github.com/bima42/inception","last_synced_at":"2025-12-29T14:03:06.364Z","repository":{"id":41298173,"uuid":"507545370","full_name":"Bima42/inception","owner":"Bima42","description":"Host a local website using Docker container (MariaDB, Wordpress and NGINX)","archived":false,"fork":false,"pushed_at":"2022-11-11T12:25:44.000Z","size":248,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-13T19:47:56.598Z","etag":null,"topics":["docker","docker-compose","docker-image","mariadb","nginx","wordpress"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Bima42.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-06-26T10:39:41.000Z","updated_at":"2022-11-11T21:34:38.000Z","dependencies_parsed_at":"2023-01-21T17:45:14.657Z","dependency_job_id":null,"html_url":"https://github.com/Bima42/inception","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Bima42/inception","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Bima42%2Finception","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Bima42%2Finception/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Bima42%2Finception/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Bima42%2Finception/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Bima42","download_url":"https://codeload.github.com/Bima42/inception/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Bima42%2Finception/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28117272,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-12-29T02:00:07.021Z","response_time":58,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["docker","docker-compose","docker-image","mariadb","nginx","wordpress"],"created_at":"2024-11-19T12:39:07.923Z","updated_at":"2025-12-29T14:03:06.321Z","avatar_url":"https://github.com/Bima42.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Inception\n- [1. Get Started](#get-started)\n- [2. Resume](#resume)\n- [3. Docker](#docker)\n- [4. Docker Commands](#docker-commands)\n- [5. Dockerfile](#dockerfile)\n  - [5.1 Dockerfile Commands](dockerfile-commands)\n    - [5.1.1 ENV](#env)\n    - [5.1.2 USER](#user)\n    - [5.1.3 ADD](#add)\n    - [5.1.4 COPY](#copy)\n    - [5.1.5 EXPOSE](#expose)\n    - [5.1.6 CMD / ENTRYPOINT](#cmd-and-entrypoint)\n- [6. Docker-compose](#docker-compose)\n  - [6.1 Docker-compose commands](#docker-compose-commands)\n    - [6.1.1 build](#build)\n    - [6.1.2 command](#command)\n    - [6.1.3 depends-on](#depends-on)\n    - [6.1.4 environment](#environment)\n    - [6.1.5 expose](#expose)\n    - [6.1.6 networks](#networks)\n    - [6.1.7 restart](#restart)\n    - [6.1.8 volume](#volume)\n- [7. Services](#services)\n  - [7.1 MariaDB](#mariadb)\n  - [7.2 Wordpress](#wordpress)\n  - [7.3 Nginx](#nginx)\n- [8. Sources](#sources)\n\n# Get Started\n- Set up your VM. I used Debian 10 for my project\n\n- Once your VM is correctly installed, run the script\n\n```\nbash ./setup_inception.sh\n```\n\n```\nmake\n```\n\n- Go to username.42.fr (if you don't make any changes, use `tpauvret` as username)\n\n# Resume\n\n![resume](/docs/Inception.png)\n\n# Docker\n- It's an open source containerization platform.\n- Enables developers to package applications into containers—standardized executable components combining application source code with the operating system (OS) libraries and dependencies required to run that code in any environment.\n- Based on LCX (LinuX Containers).\n- Docker was created to address the portability and efficiency issues of virtual machines.\n\n# Docker Commands\n```\n/// Main Commands ///\n\u003e docker build\t             # Build an image from a Dockerfile\n\u003e docker ps                  # View active containers\n\u003e docker ps -a               # View all containers\n\u003e docker rm [container]      # Delete inactive container\n\u003e docker images              # List existing images\n\u003e docker rmi [image]         # Delete image\n\u003e docker inspect [container] # Show container config\n\u003e docker build -t [image] .  # Build image from Dockerfile with name [image]\n\u003e docker inspect             # Return low-level information on Docker objects\n\u003e docker run                 # Run a command in a new container\n\u003e docker system prune -a     # Clear system\n\n\n/// DOCKER COMPOSE ///\n\u003e docker-compose up          # Launch group of containers\n\u003e docker-compose up -d       # Launch group of containers in background\n\u003e docker-compose down        # Stop processes\n\n\n/// Manage /// \n\u003e docker container           # Manage containers\n\u003e docker volume              # Manage volumes\n\u003e docker image               # Manage images\n\n```\nAnd [more](https://docs.docker.com/engine/reference/commandline/docker/) ... \n\n# Dockerfile\n- contains the necessary instructions to build a docker image\n- instructions describe the actions the image should perform once it is created\n- docker image is built by running the **docker build** command.\n- by launching a docker build, the **docker daemon** reads each line found in the dockerfile, then performs the requests requested by it\n\n## Dockerfile Commands\n| Commands         | Description                                  |\n| :----------      |:------------------------------------------   |\n| FROM             | Image source                                 |\n| ARG              | Variables used as parameters for building    |\n| ENV              | Environment variables                        |\n| USER             | User ID                                      |\n| ADD              | Add file to image                            |\n| COPY             | Add file to image                            |\n| RUN              | Commands used to build image                 |\n| EXPOSE           | Ports listened by container                  |\n| CMD/ENTRYPOINT   | Run command at container start               |\n\n![dockerfile](/docs/exemple_dockerfile.png)\n\n### ENV\n- ARG is only available at runtime\n- ENV can be accessed even when the container created by the image will be launched\n- Environment variable = variables necessary for the very execution of the container and the application\n- Database credentials are often declared in environment variables.\n\n### USER\n- Determine the user or user group that can interact with the image that will be created.\n\n### ADD\n- Allows you to copy a file or folder from an internal or external directory to a destination path.\n- Generally, this is the source code and dependencies of the application that will be running in the container.\n\n### COPY\n- COPY and ADD act the same way BUT\n- COPY does not allow importing documents from a remote source such as a URL.\n- In general, COPY is used to avoid inconveniences caused by the use of external links authorized by ADD.\n- If the destination is not specified, the file or folder will be copied to the root of the file system of the created image.\n\n### EXPOSE\n- On the port that will be mentioned that the container will be accessible when a **docker run** command is executed.\n- Port exposed using the EXPOSE command can be overridden using the **docker run -p** command.\n\n### CMD and ENTRYPOINT\n- CMD allows you to perform an action without the need for additional parameters\n- ENTRYPOINT is unchangeable and performs the same action throughout container activation. In this case, it acts as an executable file.\n\n---\n\n# Docker-compose\n- Allows you to start multiple containers at the same time\n- **docker-compose.yml**: required file that will serve as a guide to run the containers correctly\n- used to describe different containers\n\n*Example of docker-compose.yml file*\n\n~~~yml\nversion: \"3.5\"\n\nnetworks:\n    inception: {}\n\nservices:\n\n#---------------------NGINX------------------------#\n    nginx:\n        container_name: nginx\n        build: ./requirements/nginx\n        image: nginx\n        networks:\n            - inception\n        ports:\n            - 443:443\n        depends_on:\n            - wordpress\n            - mariadb\n        restart: always\n        volumes:\n            - wordpress_data:/var/www/wordpress\n\n\n#-------------------WORDPRESS---------------------#\n    wordpress:\n        container_name: wordpress\n        image: wordpress\n        build: \n            context: ./requirements/wordpress\n        env_file:\n            - .env\n        networks:\n            - inception\n        depends_on:\n            - mariadb\n        restart: always\n        volumes:\n            - wordpress_data:/var/www/wordpress\n\n\n#-------------------MARIADB---------------------#\n    mariadb:\n        container_name: mariadb\n        image: mariadb\n        build: \n            context: ./requirements/mariadb\n        networks:\n            - inception\n        volumes:\n            - mariadb_data:/var/lib/mysql\n        env_file:\n            - .env\n        restart: always\n\n#------------------VOLUMES---------------------#\nvolumes:\n    mariadb_data:\n        driver_opts:\n            type: \"none\"\n            o: \"bind\"\n            device: \"/home/tpauvret/data/mariadb\"\n\n    wordpress_data:\n        driver_opts:\n            type: \"none\"\n            o: \"bind\"\n            device: \"/home/tpauvret/data/wordpress\"\n~~~\n\n## build\n- Specifies the build configuration for creating container image from source\n\n## command\n- Overrides the default command declared by the container images \n- Can also be a list, similar to Dockerfile\n\n~~~yml\ncommand: bundle exec thin -p 3000\n\ncommand: [ \"bundle\", \"exec\", \"thin\", \"-p\", \"3000\" ]\n~~~\n\n## Docker-compose commands\n### depends-on\n- Expresses startup and shutdown dependencies between services\n- Compose implementations MUST create services in dependency order\n- Compose implementations MUST remove services in dependency order\n\n~~~yml\nservices:\n  web:\n    build: .\n    depends_on:\n      - db\n      - redis\n  redis:\n    image: redis\n  db:\n    image: postgres\n~~~\n_Here, `db` and `redis` are created before `web`. Then `web`, is removed before `db` and `redis`_\n\n### environment\n- Defines environment variables set in the container\n- Can use either array or map\n- Boolean should be enclosed in QUOTE\n- Array syntax :\n\n~~~yml\nenvironment:\n  - RACK_ENV=development\n  - SHOW=true\n  - USER_INPUT\n~~~\n\n### expose\n- Defines ports that Compose implementation MUST expose from container\n- Ports **must be accessible to linked services and should not be published to the host machine**\n\n~~~yml\nexpose:\n  - \"3000\"\n  - \"8000\"\n~~~\n\n### networks\n- Defines the networks that service containers are attached to\n\n~~~yml\nservices:\n  some-service:\n    networks:\n      - some-network\n      - other-network\n~~~\n\n### ports\n- Expose container ports\n- Port mapping MUST NOT be used with `network_mode: host`\n\n~~~yml\nports:\n  - \"3000\"\n  - \"3000-3005\"\n  - \"8000:8000\"\n  - \"9090-9091:8080-8081\"\n  - \"49100:22\"\n~~~\n\n### restart\nDefine the policy that platform will apply on container termination\n- no: The default restart policy. Does not restart a container under any circumstances.\n- always: The policy always restarts the container until its removal.\n- on-failure: The policy restarts a container if the exit code indicates an error.\n- unless-stopped: The policy restarts a container irrespective of the exit code but will stop restarting when the service is stopped or removed.\n\n~~~yml\nrestart: always\n~~~\n\n### volume\n- Defines mount hosts paths or named volumes that MUST be accessible by service containers\n- **If the mount is a host path and only used by a single service, it MAY be declared as part of the service definition instead of the top-level volumes key.**\n- **To reuse a volume across multiple services, a named volume MUST be declared in the top-level volumes key.**\n\n_This example shows a named volume (db-data) being used by the backend service, and a bind mount defined for a single service_\n\n~~~yml\nservices:\n  backend:\n    image: awesome/backend\n    volumes:\n      - type: volume\n        source: db-data\n        target: /data\n        volume:\n          nocopy: true\n      - type: bind\n        source: /var/run/postgres/postgres.sock\n        target: /var/run/postgres/postgres.sock\n\nvolumes:\n  db-data:\n~~~\nThere is some target : \n- type: the mount type volume, bind, tmpfs or npipe\n- source: the source of the mount, a path on the host for a bind mount, or the name of a volume defined in the top-level volumes key. Not applicable for a tmpfs mount.\n- target: the path in the container where the volume is mounted\n- read_only: flag to set the volume as read-only\n\n## EVERYTHING IS [HERE](https://docs.docker.com/compose/compose-file/)\n\n---\n# Services\n\nI'll let you find it by yourselves, i'll only give you some docs to check\n\n## MariaDB\n- [Definition](https://en.wikipedia.org/wiki/MariaDB)\n- [RDBMS](https://fr.wikipedia.org/wiki/Système_de_gestion_de_base_de_données)\n- [SQL Commands](https://dev.mysql.com/doc/refman/5.7/en/mysql-command-options.html#option_mysql_execute)\n\n## Wordpress\n- [Docs](https://www.digitalocean.com/community/tutorials/how-to-install-wordpress-with-lamp-on-debian-10)\n- [Other Docs](https://www.inmotionhosting.com/support/edu/wordpress/install-wordpress-debian-10/)\n\n## Nginx\n- [Definition](https://kinsta.com/knowledgebase/what-is-nginx/#:~:text=NGINX%20or%20Apache-,How%20Does%20Nginx%20Work%3F,can%20control%20multiple%20worker%20processes.)\n- [Create Container](https://www.baeldung.com/linux/nginx-docker-container)\n- [OpenSSL req](https://www.openssl.org/docs/man1.0.2/man1/openssl-req.html)\n- [Certificates](https://www.digicert.com/kb/ssl-support/openssl-quick-reference-guide.htm)\n---\n\n## Virtualization / Containers\n- Share the same operating system kernel and isolate application processes from the rest of the system\n- Run natively on their shared operating system\n- Applications and services stay lightweight and run fast in parallel\n- Linux container images provide portability and version control of applications\n- Uses less resources than a virtual machine\n![virtualization_containers](/docs/virtualization_vs_container.png)\n\n## Docker Containers\n**Modularity**\n- repair or update part of an application without having to deactivate the whole of it\n- allows to share processes between different applications\n\n**Layers and image version control**\n- each Docker image file is composed of a series of layers\n- layers assembled in single image\n- each modification of the image leads to the creation of a new layer\n- each `run or copy` command -\u003e new layer is created\n- Docker reuses its layers for building new containers -\u003e much faster\n\n**Restoration**\n- Possible to restore the versions of an image by returning to the ocuches\n\n**Rapid deployment**\n- A container for each process, can quickly share similar processes with new applications\n- No need to restart OS to add or move container\n![lxc_docker](/docs/container_linux_vs_docker.png)\n\n# Sources\n- [Docker docs](https://docs.docker.com)\n- [Docker Compose](https://docs.docker.com/compose/compose-file/)\n- [Docker Compose Tuto](https://www.youtube.com/watch?v=HG6yIjZapSA)\n- [FR Tuto](https://www.youtube.com/watch?v=fZZwN_e3LYg)\n- [Another tuto](https://www.youtube.com/watch?v=sn6PlRf-UHk\u0026t=1387s)\n- [Docker network](https://devopssec.fr/article/fonctionnement-manipulation-reseau-docker#:~:text=Ce%20type%20de%20réseau%20permet,IP%20que%20votre%20machine%20hôte.)\n- [MySQL Docs](https://dev.mysql.com/doc/refman/5.7/en/mysql-command-options.html#option_mysql_execute)\n- [Creating CSR One command](https://www.digicert.com/kb/ssl-support/openssl-quick-reference-guide.htm)\n- [Doc OpenSSL req](https://www.openssl.org/docs/man1.0.2/man1/openssl-req.html)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbima42%2Finception","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbima42%2Finception","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbima42%2Finception/lists"}