Dockerizing a REST API in Python

Dockerizing a REST API in Python

Step by step Dockerizing a Python API as a single file and optimizing the size without any external dependency.

Packaging applications as container images have been quite common for years. While creating container images, for example with Docker, image size becomes significant in many cases; due to network usage, (probably) increased attack surface, disk usage, push-pull time, longer build times, … and the list goes on. The final image frequently includes a lot of unused components; like shells, OS config files, libraries, build-time dependencies. In languages like Go, it is easy to create a statically linked executable and include it in an empty image, even without and OS if possible. But when working with Python and languages that need a virtual machine at the runtime, it is not common to use a way to achieve the same result. In this post, we will introduce a way to create Docker images for Python applications which will be less than 9 MB and based on the scratch image.

docker python docker-image dockerfiles

Bootstrap 5 Complete Course with Examples

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

Building a simple Applications with Vue 3

Deno Crash Course: Explore Deno and Create a full REST API with Deno

How to Build a Real-time Chat App with Deno and WebSockets

Convert HTML to Markdown Online

HTML entity encoder decoder Online

Docker Image and Container

Docker enables developers to easily pack, ship, and run any application as a lightweight, portable, self-sufficient container, which can run virtually anywhere. … Containers do this by enabling developers to isolate code into a single container. This makes it easier to modify and update the program

Docker creating an image | Build and run your image | Docker Fundamentals

Docker create an image from a container | Creating your own image | How to create Docker Image from a Container and Dockerfile

Docker manifest - A peek into image's manifest.json files

The docker manifest command does not work independently to perform any action. In order to work with the docker manifest or manifest list, we use sub-commands along with it. This manifest sub-command can enable us to interact with the image manifests. Furthermore, it also gives information about the OS and the architecture, that a particular image was built for. The image manifest provides a configuration and a set of layers for a container image. This is an experimenta

Docker Explained: Docker Architecture | Docker Registries

Following the second video about Docker basics, in this video, I explain Docker architecture and explain the different building blocks of the docker engine; docker client, API, Docker Daemon. I also explain what a docker registry is and I finish the video with a demo explaining and illustrating how to use Docker hub.

Docker Ecosystem: Dockerfile, Images, Containers | Basic Commands

In this video lesson following the first part, we are going to explore docker ecosystem and basic Docker objects: Images, Containers, Dockerfiles, etc. We'll play a little bit with basic Docker commands without covering them in detail.