Docker is a set of platform as a service products that uses OS-level virtualization to deliver software in packages called containers. Containers are isolated from one another and bundle their own software, libraries and configuration files; they can communicate with each other through well-defined channels.

Docker image is a read-only template that contains a set of instructions for creating a container that can run on the Docker platform. It provides a convenient way to package up applications and per-configured server environments, which you can use for your own private use or share publicly with other Docker users.

The image that your are going to push into docker.io basically has :

  • Docker file
  • Application (here we are going to use python)
  • Text file with packages (depends)

Let’s start by creating a new directory (app) and and setting up a docker file in it.

Dockerfile :

FROM python:alpine3.7
COPY . /app
WORKDIR /app
RUN pip install -r requirements.txt
EXPOSE 8080
CMD python ./index.py

FROM python:apline3.7 is the most basic version of python available in linux systems.

COPY and WORKDIR is just setting up the app as the directory are are going to work on.

Our application file might require packages that are generally not found in the basic linux version of python. So we write a requirements.txt (we will see an example below), that will hold the packages we need and on RUN command all the packages will get installed.

EXPOSE is to open up the port which we will use to connect from, we will also mention this in the application code.

We already talked about the requirements file above ,this application is a simple one and does not require many packages.

#podman #virtualization #openshift #containers #dockerfiles #docker

Uploading your first Docker Image using Podman
1.45 GEEK