Member-only story
How to decapsulate the Docker images and get the engraved code files?
A step-by-step tutorial on extracting the code files written in the image
Introduction
Docker Hub is a repository where you can find official images from Docker, verified publishers, and third-party enthusiasts. Before you pull any image, the best practice is to check the stars and the number of downloads. Also, check the image layers to avoid downloading any image with viruses or malware or spying on your host and copying any files from your host to another server.
In this tutorial, you will learn to dig deeper inside the image and dissect it to get the code files -if they were engraved in the image- and get the Dockerfile that built it.
Assume we have this image: bravinwasike/streamlitapp
. This image embeds a machine learning model with a web interface to the model, and we want to extract the code and the Dockerfile from inside it. This image uses the Naive Bayes classifier algorithm to detect the gender from the first name.
1. Pull the image to your host
First, you need to pull the image using the docker pull
command to download the image you want to decapsulate.
docker pull bravinwasike/streamlitapp
2. Get the image layers
Not every developer engraves the code in the image. Therefore, the first step is to check if there is a code path as the…