Live data from Hacker News

Ask HN: What is the best source to learn Docker in 2023?

news.ycombinator.com

21–30 of 84 posts

Re: Ask HN: What is the best source to learn Docker in 2023?

#21
It's not that complicated, just do it? The best advice I can give is shove every bit of logic you can into scripts (bash, python, whatever) and call them from bitbucket/bamboo. Be as agnostic as possible of Atlassian. That way you can run locally, experiment and learn much more easily.

Re: Ask HN: What is the best source to learn Docker in 2023?

#22

If you just want to learn it for fun and home just install portainer and run pihole, you understand a lot more. Then learn to do it via command line. Else just go for kubernetes man. With Docker shim removed from kubernetes no one is using Docker professionally.

> With Docker shim removed from kubernetes no one is using Docker professionally.

Not sure about this, Docker is still widely used in CI systems and local development in my experience.

It's also widely used in Opensource projects for "reproducible builds"

Re: Ask HN: What is the best source to learn Docker in 2023?

#23
I would start with understanding what containers are. Read up on what namespaces and cgroups are. Understand first what a container is, what it gives you and how Docker (vs other containerizers) fits into the picture. The first fundamental thing to understand is that containers are merely processes that have some sandboxing and perhaps limits applied to them, mem_cg, CFQ throttling, etc.

Once you have that under your belt it's not hard to work out how Docker itself works and how you can use it to fulfill the sort of CI/CD objectives you have outlined. Docker itself isn't important, the semantics of containerization are.

Something that Docker (and Docker like things) take massive advantage of are overly filesystems like AUFS and overlayfs, you would do good to understand these (atleast skin deep).

Finally networking becomes really important when you start playing with network namespaces, you should be somewhat familiar with atleast the Linux bridge infrastructure and how Linux routing works.

Good luck!

Re: Ask HN: What is the best source to learn Docker in 2023?

#24
ChatGPT. I’m not even joking, it’s now my first step in learning new tech (but not too new, GPT-3 was trained on a corpus ending in 2021 I believe)

Ask it something like “Explain how to get started with Docker” and it will give you a bunch of steps in a reasonable order. Then ask it for details for each step, like:

“How do I install Docker on macOS?”

“Write a commented Dockerfile for an application written in $WHATEVER”

“Now write a commented Docker Compose file for this application and a Postgres database”

etc

Re: Ask HN: What is the best source to learn Docker in 2023?

#25
I use Docker from time to time, but one question I have is more about workflow. How are people editing files within existing containers without resorting to one of the following:

1. Rebuilding the entire container which often involves stopping and starting it, etc.

2. Manually running commands that copy the files into the container. This is irritating because if I forget which files I changed or forget to run the copy command I end up with a "half updated" container.

3. SSHing into the container. This is irritating because I have to modify the port layout and permissions of the container and later remember to "restore" them when I'm "done" making the container.

Thanks!

Re: Ask HN: What is the best source to learn Docker in 2023?

#26

I use Docker from time to time, but one question I have is more about workflow. How are people editing files within existing containers without resorting to one of the following: 1. Rebuilding the entire container which often involves stopping and starting it, etc. 2. Manually running commands that copy the files into the container. This is irritating because if I forget which files I changed or forget to run the cop…

Volumes.

This works, however, only if you know beforehand which files you’re going to update frequently.

Re: Ask HN: What is the best source to learn Docker in 2023?

#29

I use Docker from time to time, but one question I have is more about workflow. How are people editing files within existing containers without resorting to one of the following: 1. Rebuilding the entire container which often involves stopping and starting it, etc. 2. Manually running commands that copy the files into the container. This is irritating because if I forget which files I changed or forget to run the cop…

What kind of files would you like to change? Anything that comprises the environment within the container (image) is indeed changed by rebuilding the container, but not the whole - just the layers which changed. Layering in a smart way increases reuse. Also, this way you reflect versions (tags) of the environment. Configuration can be passed in via parameters.

The data you work with should be stored externally (volume, database, accessed via API, …). You don‘t keep persistent state of your workload in the container.

Re: Ask HN: What is the best source to learn Docker in 2023?

#30

I use Docker from time to time, but one question I have is more about workflow. How are people editing files within existing containers without resorting to one of the following: 1. Rebuilding the entire container which often involves stopping and starting it, etc. 2. Manually running commands that copy the files into the container. This is irritating because if I forget which files I changed or forget to run the cop…

Containers are supposed to contain the entire stack a program needs to run. When you want to update anything in there, the correct answer is to build a new image.

Of course, this means that you'll not just stop, but completely destroy the old container and start a new one (created from the new image). You can get this to happen without service downtime by using the very same techniques that you'd use on any high availability / multi-server enviornment (rolling upgrades, canary deployments, etc.).

If you need to have some files that persist across these upgrades, then you use volumes and/or bind mounts. These allow you to have folders that persist independently of the container's lifecycle. They are typically used to store things like a sqlite database that the container uses, the set of configuration files that you can edit on a per-instance basis, etc.

Finally, there's a big case where you ignore all of the above: when you use containers as a development tool. In that case, particuarly for "interpreted" languages (python, php, ruby, etc.) it becomes extremely useful to bind-mount your pograms' sources inside a development container. You can then develop normally but also change the entire system where your app runs extremely easily. You can also keep different environments (language version, libraries, configuration of all those) for different projects without any change for conflicts between them, etc.

Post reply on HN