Containers : Step-0 Into The Microservices world

almamon rasool abdali
3 min readJun 12, 2021

Container: is a computing technology that provides lightweight operations and smooth applications deployment and encapsulation with efficiency and flexibility in resources sharing . Containers are faster and more
scalable than Virtual Machines (VMs); for example, a physical machine can hold more Docker containers than VMs since VM needs to maintain an operating system where it takes more memory after booting up . Docker containers take much less time than the VMs, especially when the number of instances is large.

Docker Engine

Docker: was emerged as a standard runtime, image format, and build system for Linux containers.Docker uses a concept of “ copy-on-write “ , also Docker container is built on an image. The image contains very thin layer of libraries and binaries that are required to make application work .Docker uses two proprieties of Linux kernel technology :

1- Namespaces. When we create a Docker container, we use namespaces and
calls to the Linux kernel.
2- Control groups, or cgroups. They are used for managing resources of the
container.

in docker we have Docker images

any container is build using image the image is just like the iso cd you use to install your os .

to build image you have two ways :

1- pull any docker image and just like any vm do your installation tasks and save the changes and use it latter ( this is not a recommended approach)

2- using Dockerfiles (the recommended approach ) : file contain set of instructions. Each instruction is an operation used to package the application, such as installing dependencies, compile the code, or impersonate a specific user.

here is a simple example of Dockerfile

#main or base image that we will extend and build our image from itsFROM mamonrasoolabdali/deeplearning-kerastensor# commands that run during building the imageRUN pip uninstall -y tensorflow-gpuRUN pip install tensorflowRUN pip install - upgrade pipRUN pip install - timeout=66 scikit-image#port to be exposed from the containerEXPOSE 3090#coping from src(our hos machine ) into destination (the docker image)COPY ./anpr-app /home/app#setting the defualt dir for the container once run so when open #terminal  will be executed from that dirWORKDIR /home/app#command that will run once container runCMD ["python" ,"web-anpr.py"]

i made an example of creating docker image using docker file for running nodejs simple app

another video example i made for creating image , run it , upload it to docker hub (this was part of suse: udacity foundation cloud native course )

--

--

almamon rasool abdali

a Software developer with 14 year experience - with 9 years experience in cloud , 7 years experience as a Machine learning engineer and data scientists .