The Slim.AI Blog

Container of the Week: Python & Flask

Our weekly breakdown of a popular container

From the SlimDevOps Twitch stream (opens new window): Martin and Pieter walked through the first of our weekly container slimming examples: This one is a basic containerized Python Flask API (opens new window)using the official Python3:latest container as a base image.

We first build a very simple app that merely returns a static success message. We then run through a simple testing protocol (i.e., we hit it with a web browser) to ensure it is operating correctly, and then begin the containerization process.

We use the Slim Developer Platform (opens new window)'s web portal to look inside the base image, then get to work Dockerizing our basic app. We take a quick look at layer construction (opens new window), get the container running, and re-do our simple tests to ensure it's operating as expected.

We then Slim the image using the basic DockerSlim build command. As you'll see, the slim container works exactly as the original, but is 95% lighter. As the coup de grace, we scan the image using the (opens new window) scan tool in Docker. The original image is downright scary, with 323 known security vulnerabilities, 27 of them listed as critical! The Slim image has none whatsoever.

Watch and let us know what you think over in the Slim.AI Community (opens new window).


Have a good idea for a Container of the Week example? Let us know on Twitter (opens new window) or Discord (opens new window).

Related Articles

See All Articles