Konsep Containerization dan Virtualization
Julia Ostheimer
Freelance AI Consultant







FROMFROM COPY RUNENTRYPOINTSintaks:
FROM <name_of_image>
Contoh:
# Tentukan image dasar
FROM python:3.10
Sintaks:
COPY <source> <destination>
Contoh:
# Salin file/folder ke folder utama container
COPY . .
Sintaks:
RUN <command>
Contoh:
# Instal dependensi aplikasi
RUN pip install -r requirements.txt
Sintaks:
ENTRYPOINT ["command", "argument"]
Contoh:
# Jalankan skrip saat container mulai
ENTRYPOINT ["python", "hello_world.py"]
# Define the image on which to build
FROM python:3.10
# Define the image on which to build
FROM python:3.10
# Copy files/folders to the main folder of the container
COPY . .
# Define the image on which to build
FROM python:3.10
# Copy files/folders to the main folder of the container
COPY . .
# Install the application's dependencies
RUN pip install -r requirements.txt
# Define the image on which to build
FROM python:3.10
# Copy files/folders to the main folder of the container
COPY . .
# Install the application's dependencies
RUN pip install -r requirements.txt
# Run the script when the container starts
ENTRYPOINT ["python", "hello_world.py"]
Sintaks:
docker build <context>
Sintaks:
docker run <name_of_image>
Konsep Containerization dan Virtualization