Experiment 10 CCL
Experiment 10 CCL
Experiment 10 CCL
Aim
Study and Implement containerization using Docker
Theory
1. What is containerisation
Containerization is the packaging together of software code with all it’s necessary
components like libraries, frameworks, and other dependencies so that they are isolated in
their own "container."
This is so that the software or application within the container can be moved and run
consistently in any environment and on any infrastructure, independent of that
environment or infrastructure’s operating system. The container acts as a kind of bubble
or a computing environment surrounding the application and keeping it independent of its
surroundings. It’s basically a fully functional and portable computing environment.
Containers are an alternative to coding on one platform or operating system, which made
moving their application difficult since the code might not then be compatible with the
new environment. This could result in bugs, errors, and glitches that needed fixing
(meaning more time, less productivity, and a lot of frustration).
S
N
Virtual Machines(VM) Containers
o
.
6. VM uses a lot of system memory. While containers require very less memory.
VM’s are useful when we require all While containers are useful when we are required
8. of OS resources to run various to maximise the running applications using
applications. minimal servers.
3. Security in containers
The process of securing containers is continuous. It should be integrated into your development
process, automated to remove the number of manual touch points, and extended into the
maintenance and operation of the underlying infrastructure. This means protecting your build
pipeline container images and runtime host, platform, and application layers. Implementing
security as part of the continuous delivery life cycle means your business will mitigate risk and
reduce vulnerabilities across an ever-growing attack surface.
When securing containers, the main concerns are:
The security of the container host
An IPS plays a role here as well, in a usage pattern called virtual patching. If a vulnerability is
exposed remotely, the IPS engine can detect attempts to exploit it and drop packets to protect
your application. This buys you the time needed to address the root cause in the next version of
that container instead of pushing out an emergency fix.
Monitoring your application
When deploying your application into a container, a runtime application self-protection (RASP)
security control can help. These security controls run within your application code and often
intercept or hook key calls within your code. Besides security features like Structured Query
Language (SQL) monitoring, dependencies checking and remediation, URL verification, and
other controls, RASP can also solve one of the biggest challenges in security: root cause
identification.
By being positioned within the application code, these security controls can help connect the dots
between a security issue and the line of code that created it. That level of awareness is difficult to
compete with and creates a huge boost in your security posture.
Securing your container management stack
From a security perspective, the management stack helping to coordinate your containers is often
overlooked. Any organisation that is serious about its container deployment will inevitably end
up with two critical pieces of infrastructure to help manage the process: a privacy container
registry like Amazon ECS and Kubernetes to help orchestrate container deployment.
The combination of a container registry and Kubernetes allows you to automatically enforce a set
HELLO WORLD
Playing with Busybox
Now that we have everything setup, it's time to get our hands dirty. In this section, we are going
to run a Busybox container on our system and get a taste of the docker run command.
To get started, let's run the following in our terminal:
$ docker pull busybox
Note: Depending on how you've installed docker on your system, you might see a permission
denied error after running the above command. If you're on a Mac, make sure the Docker engine
is running. If you're on Linux, then prefix your docker commands with sudo. Alternatively, you
can create a docker group to get rid of this issue.
The pull command fetches the busybox image from the Docker registry and saves it to our
system. You can use the docker images command to see a list of all images on your system.
$ docker images
# install dependencies
RUN pip install --no-cache-dir -r requirements.txt
Login Succeeded
To publish, just type the below command remembering to replace the name of the image tag
above with yours. It is important to have the format of yourusername/image_name so that the
client knows where to publish.
$ docker push yourusername/catnip
Once that is done, you can view your image on Docker Hub. For example, here's the web page
for my image.
Note: One thing that I'd like to clarify before we go ahead is that it is not imperative to host your
image on a public registry (or any registry) in order to deploy to AWS. In case you're writing
code for the next million-dollar unicorn startup you can totally skip this step. The reason why
we're pushing our images publicly is that it makes deployment super simple by skipping a few
intermediate configuration steps.
Now that your image is online, anyone who has docker installed can play with your app by
typing just a single command.
$ docker run -p 8888:5000 yourusername/catnip
If you've pulled your hair out in setting up local dev environments / sharing application
configuration in the past, you very well know how awesome this sounds. That's why Docker is
so cool!
Beanstalk
AWS Elastic Beanstalk (EB) is a PaaS (Platform as a Service) offered by AWS. If you've used
Heroku, Google App Engine etc. you'll feel right at home. As a developer, you just tell EB how
to run your app and it takes care of the rest - including scaling, monitoring and even updates. In
April 2014, EB added support for running single-container Docker deployments which is what
we'll use to deploy our app. Although EB has a very intuitive CLI, it does require some setup,
and to keep things simple we'll use the web UI to launch our application.
To follow along, you need a functioning AWS account. If you haven't already, please go ahead
and do that now - you will need to enter your credit card information. But don't worry, it's free
and anything we do in this tutorial will also be free! Let's get started.
Here are the steps:
● Login to your AWS console.
● Click on Elastic Beanstalk. It will be in the compute section on the top left. Alternatively,
Conclusion
Advantages and limitations of containers
Even if containerization conveys numerous advantages to freight distribution, it does not come
without challenges. The main advantages of containerization are:
● Standardization. The container is a standard transport product that can be handled
anywhere in the world (ISO standard) through specialized modes (ships, trucks, barges,
and wagons), equipment, and terminals. Each container has a unique identification
number and a size type code allowing to be a unique transport unit that can be managed
as such.
● Flexibility. Containers can be used to carry a wide variety of goods such as commodities
(coal, wheat), manufactured goods, cars, and refrigerated (perishable) goods. There are
adapted containers for dry cargo, liquids (oil and chemical products), and refrigerated
REFERENCES
https://transportgeography.org/contents/chapter5/intermodal-transportation-
containerization/containerization-advantages-drawbacks/
https://docker-curriculum.com/#getting-started