Learning to use Docker

I recently had the experience of trying to learn ( from scratch) how to use Docker containers.

I chose to do this with Docker in Void Linux, because I wanted to learn from the command line. Doing it the hard way is often the best way to gain an understanding.

I can report that it takes about 2 weeks of trial and error, that the online documentation is not up to scratch, but that docker itself performs well, as expected given its major use by software developers.

What I plan to do next is explore

  • using a docker container for a large software build in my own work
  • can we use docker containers in itsFOSS to share things

If anyone is interested in my learning path, there is a document on my Github site

You should click on the file voiddocker.pdf , and if it does not automatically download, click the download button.
Be warned, it is all command line stuff.

Regards
Neville

3 Likes

I support our Kubernetes clusters at work and use Docker quite a bit, but would still not consider myself an expert. I tend to use Podman rather than Docker. It’s a command line tool that is compatible with Docker, but is daemonless. I think it started life at Red Hat.

This looks like a nice article on Podman: What is Podman? - Everything You Need to Know | phoenixNAP KB

1 Like

Thanks, I will have a look at Podman. I found the learning curve rather steep.
My understanding is Kubernetes is just for managing lots of containers. Is that right?

Hi Neville, :wave:

What a coincidence.
As a matter of fact I installed docker (for the first time) only recently in my Debian10 VM (6/14/2022) :wink:

sudo apt-get update
	sudo apt-get install apt-transport-https ca-certificates curl gnupg2 software-properties-common
	curl -fsSL https://download.docker.com/linux/debian/gpg | sudo apt-key add -
	sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/debian buster stable"
	sudo apt-get update
	sudo apt-get install docker-ce docker-ce-cli containerd.io

I followed the source from How To Install Docker on Debian 10 Buster (Step-by-Step)
Quite an odyssey for me but finally I succeeded. :smile:

Thanks for the link you provided. I hope to get to read you pdf soon.
I really admire you. :+1:

Many greetings
Rosika :slightly_smiling_face:

1 Like

I’ve started reading the PDF.

The introduction starts like this.

A reasonable explanation of what docker is and how it works is given in this
tutorial [2]. In one sentence docker is like a VM , but it only containerizes a
selected part of user space. It was originally intended to be used for providing
an isolated environment for software development. Other uses have developed.

On point and absolutely correct.

Two key concepts are images and containers. A docker image is the software
which is containerised. There is a registry of useful images called Docker Hub [4].
A docker container a copy of an image, along with some organization which
allows it to be moved, installed, modified and run.

Not entirely correct or at least confusing.

The Docker Image is the unborn Docker container. It is declaratively designed through a Dockerfile.
It does not have a “running” state, as it is more like a cake, which never goes bad, but also isn’t baked, yet.
Creating a container of an image is like taking that cake and actually baking it. You do something with it.

A container has a “running” state, because you do something in it. For example, you run software inside that container.

While images and containers are different in that regard, it’s usually best to keep the container as close as possible to the initial image design by Dockerfile, because this way you keep the designing possibilities on the image, i.e. Dockerfile level.

In other words, the Dockerfile is the declarative “recipe” and the image is the result of that recipe in perfect form.
Then, this perfect form is taken and used in real life, i.e. in a container.

2 Likes

That analogy is really helpful, thank you.

I can see that I only had a half-correct view of what these entities are
and how they interact.
Now that you have enlightened me, I need to go and read the documentation again.
Learning involves repetition
Regards
Neville

1 Like

Hi Rosika,
If you do read my document, take account of @Akito 's comments. There are some things in the introduction that are not quite correct.

You may find it useful to see how I went about learning to use docker. ,
depending on how far you have got with it yourself.

I will probably be putting it on Debian myself, so your reference will help.

Thank you for the compliment
Neville

1 Like

I learned the most by just doing it, not reading the documentation. I read only the most basic parts of the documentation, plus whatever documentation is available for docker-compose. Yet, I’d say I have a pretty thorough understanding of Docker. It’s because I have used it tons of times for years in a variety of manners.

2 Likes

True words.
I will add a note to my document pointing out to reader that my intro has some misconceptions.

Correct. Kubernetes is a “scheduler” for lots of pods. It also has facilities for ingress/load balancing. Another big advantage would be high availability.

But not worth it unless you have lots of workload for it or cost of downtime is high or you just want to learn something valuable for a new career phase.

If someone is interested in Kubernetes a nice way to experiment with it is by installing MICROK8S on Ubuntu. It’s a snap that performs like a one node Kubernetes cluster.

1 Like

Thats great. You have taken the mystery out of it.
All this modern jargon is leaving poor old me behind

I understand, this post was intended to summarize the meaning for beginners, however even then I find this part of the description too limiting, which is why it might leave the wrong impression on readers.

I would recommend using the official word used, whenever something like Kubernetes is described – it’s “orchestrator”.

Scheduling is just one little part of the whole orchestration process. Kubernetes is huge and makes developers and administrators think completely differently, which is better.

Additionally, it’s not just about “managing” lots of containers. From a very narrow perspective, one could describe it like that, but I think it’s described the wrong way around. It’s not like random developers put their stuff in Docker images, because everyone does it and then you have so many, that you need something like Kubernetes for it. That’s not the case.

The reality is, that Kubernetes is currently the best software deployment technology & strategy available. As of now, there is no better technology that fits our current time & its requirements better.

So, Kubernetes is not a “solution” to a “problem” with “managing” Docker containers. Having software architectured in a way that fits Kubernetes is actually desired!
Up to date developers and DevOps engineers strive to have their deployments work according to how the Kubernetes strategy recommends & demands it.

That means in practice, that software, which works well and is very compatible with containerisation technologies (Docker is not even the main kid for Kubernetes, anymore) running in Kubernetes is highly sought after and influences architectural design decisions.

Kubernetes revolutionised the deployment and system administration world in a very positive way.

2 Likes

To anyone who might have downloaded my Github document.
There has been an update with some corrections.
Apologies
Neville

1 Like

Hi Neville, :wave:

Thanks, I´ll do that.

I just wanted to mention (some sort of ) a reference book I recently stumbled across:

Free eBook: “Docker Containerization Cookbook” - Hot Recipes for Docker Automation

Delve into the world of Docker Containerization with this compact handbook that introduces common recipes for the Docker Automation Tool!

It can be found here: Docker Containerization Cookbook Free eBook

But I think in the meantime you´ve acquired such a profound knowledge you won´t need such a help anymore. Sorry for the bother. :neutral_face:
Well, I thought I might mention it anyway. :wink:

Many greetings
Rosika :slightly_smiling_face:

Hi Rosika,
My knowledge of this topic is nowhere near what you seem to think.
I think that book is for Java programmers. I dont use Java.
Everyone has their limitations. Thank you for mentioning it. I do need some better documentation
Regards
Neville

1 Like

Dear Neville, :wave:

So sorry for having bothered you. :slightly_frowning_face:
I think I got carried away by the sub-title Hot Recipes for Docker Automation

This is a closer description:

Docker is the world’s leading software containerization platform.
Docker containers wrap a piece of software in a complete filesystem that contains everything needed to run: code, runtime, system tools, system libraries – anything that can be installed on a server.
This guarantees that the software will always run the same, regardless of its environment. Docker provides an additional layer of abstraction and automation of operating-system-level virtualization on Linux.
Docker uses the resource isolation features of the Linux kernel such as cgroups and kernel namespaces, and a union-capable file system such as OverlayFS and others to allow independent “containers” to run within a single Linux instance, avoiding the overhead of starting and maintaining virtual machines.

In this eBook, we provide a compilation of Docker examples that will help you kick-start your own automation projects. We cover a wide range of topics, from installation and configuration, to DNS and commands. With our straightforward tutorials, you will be able to get your own projects up and running in minimum time.

As there´s no mentioning “java” in here I didn´t realize the “problem”.

Please accept my apologies. :pensive:

Many greetings
Rosika :slightly_smiling_face:

1 Like

It seems like it’s released by Java code geeks, so it may contain examples using Java.

However, when it comes to using & learning Docker, it does not matter what runs in it. It just about deploying something and that means, if you learn how to deploy some Java program, you can easily learn, with little adjustments, how to deploy programs written in R, Rust, other JVM based languages, etc…

It’s not like you need Java. It’s just an example, using the one of the most popular languages in the entire world.

2 Likes

No apologies needed.
In fact that sounds a lot better than my first impression. I shall download it.
It is actually a good statemet of what docker containers are used for.
Regards
Neville

1 Like

I love it when you write about things you feel are important
I am afraid I do not have your poetic talent, but I can appreciate it.

1 Like

You´re too kind, Neville. Thanks so much. :heart:

Many greetings from Rosika :slightly_smiling_face: