Containers are groups of processes running on a Linux system that are isolated from each other.
Resource constraints:
(cgroups)
Virtualization equivalent: namespaces. Examples are
Software projects and products that orchestrate containers onto multiple different machines or nodes
used for configuring containerized applications to run on a single local node. launched by:
Configure different parts of the Linux kernel and launch the containerized application.
| command | action |
|---|---|
podman ps (--all) | List running containers (and stopped) |
podman run (-it --rm) | runs a container (interactive mode, remove at the end) |
podman stop | stop a running container |
podman start | starts a stopped container |
podman rm | remove a stopeed container (possible data loss) |
podman images | list available container images |
podman image rm | remove an image |
podman exec | execute a command in a pod |
The Dockerfile is a text-based file used to create a container image. It provides the recipy to build the environemnt for your app.
FROM python:3.12
# Install the application dependencies
WORKDIR /usr/local/app
COPY requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt
# Copy in the source code
COPY src ./src
# Setup an app user so the container doesn't run as the root user
EXPOSE 8080
RUN useradd app
USER app
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8080"]
FROM python:3.12
# Install the application dependencies
WORKDIR /usr/local/app
COPY requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt
# Copy in the source code
COPY src ./src
# Setup an app user so the container doesn't run as the root user
EXPOSE 8080
RUN useradd app
USER app
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8080"]
FROM python:3.12
# Install the application dependencies
WORKDIR /usr/local/app
COPY requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt
# Copy in the source code
COPY src ./src
# Setup an app user so the container doesn't run as the root user
EXPOSE 8080
RUN useradd app
USER app
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8080"]
FROM python:3.12
# Install the application dependencies
WORKDIR /usr/local/app
COPY requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt
# Copy in the source code
COPY src ./src
# Setup an app user so the container doesn't run as the root user
EXPOSE 8080
RUN useradd app
USER app
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8080"]
FROM python:3.12
# Install the application dependencies
WORKDIR /usr/local/app
COPY requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt
# Copy in the source code
COPY src ./src
# Setup an app user so the container doesn't run as the root user
EXPOSE 8080
RUN useradd app
USER app
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8080"]
| Instruction | Description |
|---|---|
| FROM | Create a new build stage from a base image. |
| RUN | Execute build commands. |
| ENV | Set environment variables. |
| WORKDIR | Change working directory. |
| COPY | Copy files and directories. |
| EXPOSE | Describe which ports your application is listening on. |
| USER | Set user and group ID. |
| CMD | Specify default commands. |
| ENTRYPOINT | Specify default executable. |
CMD defines the default executable of a Docker image. If you add an argument to the command, you override the CMD.
You cannot override the ENTRYPOINT instruction by adding command-line parameters to the docker run command
# build
podman build . -t mycontainer:verions
# and publish
podman push localhost/mycontainer:version somewereFor those of you who didn't, Check that you can connect to cockpit (last week slides)
import sys
# Check if the correct number of arguments is provided
if len(sys.argv) != 3:
print("Usage: python script.py ")
sys.exit(1)
# Get the arguments from the command line
try:
num1 = float(sys.argv[1])
num2 = float(sys.argv[2])
except ValueError:
print("Please provide two numbers.")
sys.exit(1)
# Calculate the sum
result = num1 + num2
# Print the result
print(f"The sum of {num1} and {num2} is: {result}")
FROM python:3.12-alpine
WORKDIR /opt
COPY main.py .
ENTRYPOINT ["python", "main.py"]# BOTH FILES MUST BE IN THE SAME FOLDER
podman build . -t demo:v0.0.1
podman run demo:v0.0.1 1 2
# finally check
podman ps --all
# what happened?podman run -d -v ./html:/var/www/html:ro,z -p 8080:8080



Host mdmc_vm
ProxyJump mdmc_gateway
Hostname 172.16.0.XX
User user00
LocalForward 8989 localhost:8000
LocalForward 9090 localhost:9090
LocalForward 9091 localhost:9091
have a look at the minio registry on quay
# get the binary
curl https://dl.min.io/client/mc/release/linux-amd64/mc \
--create-dirs \
-o $HOME/.local/bin/mc
# make it executable
chmod +x $HOME/.local/bin/mc
# take a look at the instructions
mc --help



# check where you can load files
mc alias list
# load a file
mc cp my-file local/bucket/my-file