What is a Docker image?
A Docker image is a file used to execute code in a Docker container.
Docker images act as a set of instructions to build a Docker container, like a template.
Docker images also act as the starting point when using Docker
What am I containerizing?
Containerization is a software deployment process that bundles an application's code with all the files and libraries it needs to run on any infrastructure.
What can you containerize?
Software developers use containerization to deploy applications in multiple environments without rewriting the program code
Architecture layer of containerizing
Hardware Infrastructure
With any application, it all starts with physical compute resource somewhere. whether those resource are your own laptop or speed across multiple cloud datacenters, they are a must-have for containers to work.
Host Operating System
It is a software installed on a computer system that communicates with the underlying hardware.
Container Engine
It can run multiple, isolated instances, known as containers, on the same operating system kernel. Containers performs virtualization at the operating system level, and provide a controllable, easily manageable environment for running applications and dependencies.
Container Application
Containerized application are applications run in isolated packages of code called containers. Containers include all the dependencies that an application might need to run on any host operating system, such as libraries, binaries, configuration files, and frameworks, into a single lightweight executable.
How to create my own image?
Dockerfile
FROM Ubuntu
RUN apt-get update
RUN apt-get install python
RUN pip install install flask
RUN pip install flask-mysql
COPY . /opt/source-code
ENTRYPOINT FLASK_APP=/opt/source-code/app.py flask run
Docker file
Dockerfile
INSTRUCTION ARGUMENT
FROM Ubuntu
RUN apt-get update
RUN apt-get install python
RUN pip install flask
RUN pip install flask-mysql
COPY . /opt/source-code
ENTRYPOINT FLASK_APP=/opt/source-code/app.py flask run
CMD vs ENTRYPOINT
CMD
FROM ubuntu
CMD sleep 5
ENTRYPOINT
FROM ubuntu
ENTRYPOINT ["sleep"]
If you liked what you read, do follow and Any feedback for further improvement will be highly appreciated!
Thank you and Happy Learning!👏