mirror of
https://github.com/Snigdha-OS/snigdhaos-docker.git
synced 2025-09-05 17:36:36 +02:00
c1c3df4f847600d7c8553f247c47c15ad89f0f9b
INTRODUCTION TO DOCKER
A Dockerfile is a text file that contains a set of instructions used to automate the creation of a Docker image. It defines the environment, software dependencies, configurations, and commands that will be executed inside a container when it is built and run. Dockerfiles are used by Docker to build images, which can then be used to create containers.
Here's a breakdown of common Dockerfile instructions:
- FROM: Specifies the base image to use (e.g.,
FROM ubuntu:20.04
). - RUN: Executes commands inside the image, such as installing software packages (e.g.,
RUN apt-get update
). - COPY: Copies files or directories from your local filesystem to the image (e.g.,
COPY . /app
). - ADD: Similar to
COPY
, but can also handle URLs and unpack compressed files. - WORKDIR: Sets the working directory for subsequent instructions (e.g.,
WORKDIR /app
). - CMD: Specifies the default command to run when a container is started (e.g.,
CMD ["python", "app.py"]
). - EXPOSE: Informs Docker that the container will listen on specific ports (e.g.,
EXPOSE 80
). - ENV: Sets environment variables in the container (e.g.,
ENV APP_ENV=production
). - ENTRYPOINT: Defines the command that will always run when the container starts, even if a different command is provided at runtime.
- VOLUME: Creates a mount point for volumes, allowing data persistence (e.g.,
VOLUME /data
).
Example Dockerfile:
# Use the official Python image as the base image
FROM python:3.8-slim
# Set the working directory in the container
WORKDIR /app
# Copy the current directory contents into the container
COPY . /app
# Install any necessary dependencies
RUN pip install -r requirements.txt
# Expose port 5000
EXPOSE 5000
# Define the default command to run the app
CMD ["python", "app.py"]
Key Uses of a Dockerfile:
- Reproducibility: The same Dockerfile can be used to build the same environment across different systems, ensuring consistency.
- Automation: A Dockerfile allows you to automate the process of building an image with specific configurations and software.
- Portability: Once built, Docker images can be shared and run on any platform that supports Docker.
In essence, a Dockerfile is a blueprint for creating Docker images, ensuring the environment is consistent and reproducible.
Description
🐳 The Snigdha OS Docker repository contains configurations and Dockerfiles to run Snigdha OS in Docker containers. It provides a lightweight, isolated environment for developers and testers to work with Snigdha OS, making it easy to integrate, deploy, and test within containerized setups.
Readme
148 KiB
Languages
Dockerfile
64.4%
Shell
35.6%