Getting to know Docker… and God knows what else [Part 1]

The Docker logo: the first shaded figure on the perimeter

Let’s dive into Docker

Top Gear doing the same thing

What is Docker then?

Why do I care?

Container and VM Architecture

An images showing the difference from: https://www.backblaze.com/blog/vm-vs-containers/

It follows that you can’t interfere with something if it’s not visible to you. And that’s really what namespaces provide — a way to limit what a process can see, to make it appear as though it’s the only process running on a host.

Without namespaces, a process running in container A could, for example, umount an important filesystem in container B, or change the hostname of container C, or remove a network interface from container D. By namespacing these resources, the process in container A isn’t even aware that the processes in containers B, C and D exist.

Recently, there has been a growing number of programming contest and “hackathon” platforms, such as HackerRank, TopCoder, Codeforces, and many more. A lot of them utilize automated pipelines to run and validate programs that are submitted by the contestants. It is often impossible to know in advance the true nature of contestants’ programs, and some may even contain malicious elements. By running these programs namespaced in complete isolation from the rest of the system, the software can be tested and validated without putting the rest of the machine at risk.

Docker installation

Using a Container

docker container run --detach --publish 8080:80 --name nginxContainer nginx

Killing it

The only thing that wasn’t taught is how to terminate a container once completed. This is handily done by the command docker kill <nameGoesHere>

You can find the name of the container again by the command docker ps -q. ps stands for list containers — go figure…

Docker Images: What are they again?

An image is essentially and instruction set and materials required to create a container.

FROM ubuntu
ADD myapp /
EXPOSE 80
ENTRYPOINT /myapp
FROM python:3.6.1-alpine
RUN pip install flask
CMD ["python","app.py"]
COPY app.py /app.py
Example of running the program on a normal console.
docker image build -t <<<name goes here>>> .
docker container lsdocker container stop <<<idOfContainer>>>docker system prune

Why are containers good?

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store