User Tools

Site Tools


porting_an_lxc_to_docker

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
porting_an_lxc_to_docker [2024/08/11 19:21] – [General Outline for Container Creation] osoporting_an_lxc_to_docker [2024/10/17 21:42] (current) – external edit 127.0.0.1
Line 85: Line 85:
 **Explanation**: **Explanation**:
   * `FROM python:3.9-slim`: This uses a lightweight Python 3.9 image as the base.   * `FROM python:3.9-slim`: This uses a lightweight Python 3.9 image as the base.
 +  * **Explanation of MariaDB Connector/C and Dependencies**
 +<code dockerfile>
 +# Install MariaDB Connector/C library and other dependencies
 +RUN apt-get update && apt-get install -y \
 +    libmariadb3 \
 +    libmariadb-dev \
 +    gcc \
 +    && apt-get clean \
 +    && rm -rf /var/lib/apt/lists/*
 +</code>
 +  * **`RUN apt-get update && apt-get install -y \`**: 
 +    - This command updates the package list on the Debian-based slim image and installs the specified packages.
 +  * **`libmariadb3`**: 
 +    - **What it is**: This is the shared library for MariaDB Connector/C, which is a lightweight client library to connect your Flask application to a MariaDB database.
 +    - **Why it’s needed**: If your Flask app interacts with a MariaDB database, this library allows it to establish that connection.
 +  * **`libmariadb-dev`**: 
 +    - **What it is**: This is the development package for MariaDB Connector/C. It includes the headers and static libraries needed for compiling programs that use MariaDB.
 +    - **Why it’s needed**: If you have Python packages in `requirements.txt` that need to compile C extensions (for example, `mysqlclient`), they require these development files to build correctly.
 +  * **`gcc`**: 
 +    - **What it is**: The GNU Compiler Collection, a compiler system that supports various programming languages.
 +    - **Why it’s needed**: This is required to compile any C extensions or Python packages that need compilation, particularly those that depend on the MariaDB libraries mentioned above.
 +  * **`&& apt-get clean && rm -rf /var/lib/apt/lists/*`**: 
 +    - **What it does**: This cleans up the package lists and removes any cached data from `apt-get`, which reduces the size of the Docker image by removing unnecessary files.
   * `WORKDIR /app`: Sets the working directory inside the container.   * `WORKDIR /app`: Sets the working directory inside the container.
   * `COPY requirements.txt requirements.txt`: Copies the `requirements.txt` file into the container.   * `COPY requirements.txt requirements.txt`: Copies the `requirements.txt` file into the container.
Line 349: Line 372:
   * LXC documentation: https://linuxcontainers.org/lxc/introduction/   * LXC documentation: https://linuxcontainers.org/lxc/introduction/
  
 +https://docs.facundoitest.space/doku.php?id=crear_container_con_apps_en_python_para_aci
porting_an_lxc_to_docker.1723404083.txt.gz · Last modified: 2024/10/17 21:42 (external edit)