Live data from Hacker News

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

news.ycombinator.com

61–70 of 84 posts

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

#61
I have a recent course on LinkedIn Learning that digs into the basics of Docker! Check it out if you have a subscription: https://www.linkedin.com/learning/learning-docker-17236240.

I'm in the process of making a follow-up to this that covers more advanced topics. Stay tuned.

I also have a course that shows you how to use Docker for the build-test-deploy loop, though some of it is a little stale. Check that out here: https://www.linkedin.com/learning/devops-foundations-your-fi...

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

#62

I'm not a fan of video tutorials, but Bret Fisher's[0] docker stuff is the exception. The production quality is flawless, the content is straight to the point, and his instruction is amazing. I cannot recommend it enough [0] https://www.udemy.com/user/bretfisher/

I can vouch for Bret Fisher's content! Excellent instructor and great person.

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

#63

It's funny that you asked this, because just the other day I was thinking about starting a series of posts about it, but then I thought "what the hell, it's 2023, everybody should know about how to use Docker already" and diminished the idea.

A lot of people know. But a lot people doesn’t. E.g. if one is a freshman in college, then they probably are not yet an expert in containers. Or if someone learned about containers in 2015, they might not be up to date with the best practices of 2023.

IMHO there’s still room for hiqh-quality blog posts about containers. E.g. there are lots of gotchas that could be explained. E.g. if you keep your commands in a suboptimal order, you will not get the benefit of caching when building the container. And why use multi-stage builds etc etc.

PS. See also https://xkcd.com/1053/ :)

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

#65
I would also be interested to know what the typical dev workflow is like these days when working with containers.

Like do you just run e.g. nodejs or javac locally and then "deploy" to a container, or do you have a development container where you code "in it", or is a new container built on every file change and redeployed?

At my current place of work, all of this is totally abstracted away so no idea how real world people do it!

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

#66
Sounds like your challenge is more about integrating the containers in a useful pipeline to get ephemera (preview) environments. Like deploy a new env for each PR and update each env when it's branch gets a new commit.

An easy way to get ephemeral envs starting from your docker-compose definition is Bunnyshell.com. It uses Kubernetes behind the scenes, but it's all pretty much abstracted away from the user. There is a free so you can experiment.

Disclosure: I'm part of the Bunnyshell team.

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

#67

I would also be interested to know what the typical dev workflow is like these days when working with containers. Like do you just run e.g. nodejs or javac locally and then "deploy" to a container, or do you have a development container where you code "in it", or is a new container built on every file change and redeployed? At my current place of work, all of this is totally abstracted away so no idea how real world…

I'm not sure if my workplace is "typical", but what we do for local development is only to use containers for dependencies, such as the database, or localstack (an AWS emulator). We have bash scripts that can set up and tear them down, using docker compose. Typically, we create a database container and then use it until we need to restart it for some reason, such as if the schema has changed.

There's a shared repository we use that hosts all our migrations and has a script to refresh a set of schema files that define our current schema by running the migrations against a fresh, empty database container; this repository is referenced by our code repositories as a git submodule.

We have one shared database that multiple apps use, and the above setup has worked out reasonably well for us. It's not terribly fancy, and I'm sure there are better ways out there we haven't discovered, but we have a good amount of flexibility.

Also, that's all just for local manual testing/exploration -- we also use Java's "testcontainers", which spins up its own containers (though basically the same idea) for automated tests to run against. Testcontainers lets you specify how it restarts the containers -- after each test class, after each test run, or not at all. Restarting the container is pretty slow, so we have it set up to just drop and recreate the relevant databases within the container.

For deployment, we've used different platforms that deploy apps in containers, but we don't manage the containers directly.

Also, I've tried the "develop in a container" thing but only on rare occasions, such as to work around a MacOS bug that makes CIFS file sharing horribly slow. Technically that was a Vagrant VM, not a container. Haven't had much luck with it otherwise -- it seemed like more trouble than it was worth (it's the awkward file syncing that's the barrier for me).

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

#68
I don't think spinning up a docker image through a Github Action is possible or if that makes sense for CI/CD but here is an example repo with Node [1]. There are two actions, one for Unit Tests and one that builds a prod image and pushes it to my Docker Hub account. I have a compose.dev.yml file to start the containerized services, and a compose.yml to do the same in production. For Prod it all depends on your prod cloud service you want to deploy your container to (e.g. Google Cloud Run) and there are Github Actions for them.

[1] https://github.com/vasilionjea/node-docker-template

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

#69

I would also be interested to know what the typical dev workflow is like these days when working with containers. Like do you just run e.g. nodejs or javac locally and then "deploy" to a container, or do you have a development container where you code "in it", or is a new container built on every file change and redeployed? At my current place of work, all of this is totally abstracted away so no idea how real world…

Typically I use a multi stage build so I build the app in one container, and copy the result to a final output container. That keeps the final container clean and lightweight. Pure local development I prefer to do locally outside of any container.

There's certainly patterns you can use to run things like auto compiling code (think angular app in dev server mode) as you save in a container to ensure a consistent dev environment. However, I usually find that you're fighting the operating system and dev tooling on things like volume syncing that makes it not actually a net benefit. Though if I were to tackle getting my 100 devs consistent and I know they all have the same OS layout it probably would be worth it.

The only time I tend to code "in" a container is when it's a very large code base with complicated dev tooling, or tooling I need to containerize to avoid clashing with my OS. In that case I build a "build container" and run it with a volume mount pointing to my working directory, rather than do a docker build. For a large code base, the purist "build with docker" approach requires copying that whole build context each time. Causing the build to take forever and thrash disk space

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

#70
It seems that you are mainly interested in how to build preview environments for your app, these posts describe an approach to get there:

- https://softwaremill.com/preview-environment-for-code-review...

- https://softwaremill.com/preview-environment-for-code-review...

- https://softwaremill.com/preview-environment-for-code-review...

While the examples use Gitlab, it shouldn't be very hard to port the same idea to a Bitbucket.

Post reply on HN