Live data from Hacker News

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

news.ycombinator.com

31–40 of 84 posts

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

#31

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…

You didn't specify, but it sounds like you're talking about from a development perspective, not a deployment one.

For development, you add a volume to the container and mount a location on that volume to a location on your host hard drive. There are different mount options that control which changes propagate in which direction, but two-way propagation is avaliable and works fine.

Once you have this set up, any changes you make on your host system are automatically reflected in your containers volume. It's very low stress and low overhead, honestly.

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

#32
post #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 $WHATEV…

The other day i asked chatgpt to write me a sample program with a particular tui library. It wrote the python example. Very impressive. Trouble is, it was a go library. No name clash or anything. It flat out wrote sample code for a lib that did not exist. When prompted that it is a go library. It wrote a similar correct looking program with functions that don't exist in the go library.

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

#37
Step 0: Start with a device that "fully" supports docker.

This is the reason I gave up on learning docker properly. I had 3 devices at my disposal - M1 mac, a windows 10 pc and a rpi. The random errors I was getting made me quite frustrated. Keep a code diary and document your mistakes and solutions.

Also get a VPS. Never ever try a serverless solution when trying to properly learn docker. Also, do not try to do anything that involves GPU processing.

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

#39
post #35

Julia Evan's How Containers Work! zine: https://jvns.ca/blog/2020/04/27/new-zine-how-containers-work... It demystified a lot of docker features for me.

I almost pasted this webzine, but luckily searched before posting. This is a great resource!

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

#40
post #18
post #16

Earlier quoted context omitted.

> I prefer docker compose to Kubernetes because I am not a megacorp. In which cases would you prefer Kubernetes? Or rather, why would a megacorp prefer it over standard Docker?

Kubernetes and docker solve different problems. One is a container runtime, the other is a container orchestration tool. A mega-corp using Kubernetes can still use Docker, the two can work together. "Docker compose" (not the same thing as docker) works great at single machine scale/local development environments, but isn't really designed to scale much beyond this to production environments, multiple servers and data…

> "Docker compose" (not the same thing as docker) works great at single machine scale/local development environments, but isn't really designed to scale much beyond this to production environments, multiple servers and data centers etc, which Kubernetes is. This isn't to say you couldn't deploy something to production with compose, its just not very likely outside of small personal projects - there are heaps of features in Kubernetes that simply don't exist in compose.

In short:

  - if you need to deploy containers on a single node ad-hoc, then you want Docker or a similar runtime (e.g. Podman)
  - if you need to deploy containers on a single node with a deployment descriptor, then Docker Compose is a good option, due to its simplicity
  - if you need to deploy containers across multiple nodes with a deployment descriptor, then you want some sort of an orchestrator
I'd say that going from Docker Compose to Docker Swarm is the first logical step, because it's included in a Docker install and also uses the same Compose format (with more parameters, such as deployment constraints, like which node hostname or tag you want a certain container to be scheduled on): https://docs.docker.com/compose/compose-file/compose-file-v3... That said, you won't see lots of Docker Swarm professionally anymore - it's just the way the job market is, despite it being completely sufficient for many smaller projects out there, I'm running it in prod successfully so far and it's great.

Another reasonably lightweight alternative would be Hashicorp Nomad, because it's free, simple to deploy and their HCL format isn't too bad either, as long as you keep things simple, in addition to them supporting more than just container workloads: https://www.hashicorp.com/products/nomad That said, if you don't buy into HashiStack too much, then there won't be too much benefit from learning HCL and translating the contents of various example docker-compose.yml files that you see in a variety of repos out there, although their other tools are nice - for example, Consul (a service mesh). This is a nice but also a bit niche option.

Lastly, there is Kubernetes. It's complicated, even more so when you get into solutions like Istio, typically eats up lots of resources, can be difficult to manage and debug, but does pretty much anything that you might need, as long as you have either enough people to administer it, or a wallet that's thick enough for you to pay one of the cloud vendors to do it for you. Personally, I'd look into the lightweight clusters at first, like k0s, MicroK8s, or perhaps the K3s project in particular: https://k3s.io/

I'd also suggest that if you get this far, don't be afraid to look into options for dashboards and web based UIs to make exploring things easier:

  - for Docker Swarm and Kubernetes there is Portainer: https://www.portainer.io/
  - for Kubernetes in particular there is Rancher: https://www.rancher.com/ (they are also the people behind K3s)
  - Kubernetes also has its own dashboard, but it's a bit less nice in my opinion: https://kubernetes.io/docs/tasks/access-application-cluster/web-ui-dashboard/
  - Hashicorp Nomad comes with its own web UI as well, though I recall it being a bit barebones: https://developer.hashicorp.com/nomad/tutorials/web-ui
In the terminal, there are also a few useful projects:

  - for Docker, there is ctop: https://github.com/bcicen/ctop
  - for Kubernetes, there is k9s: https://k9scli.io/
As for a desktop UI, there are a few options too:

  - Docker Desktop: https://www.docker.com/products/docker-desktop/
  - Rancher Desktop: https://rancherdesktop.io/
  - Podman Desktop: https://podman-desktop.io/
You don't strictly need any fancy tools like that and Docker/Podman CLI, or kubectl can be enough, but sometimes a more visual look and being able to click around can be nice.
Post reply on HN