Software Architect / Entrepreneur

Software Architect / Entrepreneur

Understanding How Docker Containers Work

Getting into Docker can be confusing since they don’t normally behave the same way as we’re used to, working with servers. Here we talk about how containers work in deployment terms.

Share on facebook
Facebook
Share on twitter
Twitter
Share on linkedin
LinkedIn

If you primarily have worked deploying to Linux servers, you are most definitely accustomed to deploying incremental changes. Transitioning to Docker you’ll have to adapt that way of thinking.

Docker containers are ephemeral, which means they don’t last very long in deployment terms. In many cases they will be rebuilt from scratch. It’s almost like starting a new server from zero every single time. This is different than servers where you only change what you need to change and that’s it. If, for instance, you want to add a package with apt you’d just run the command and apart from installing  that new package, the server remains mostly untouched.

In Docker that scenario would be completely different. You would actually have to rebuild the container completely to add the package. This is important because by default dynamic information like user uploaded files, environment-specific files, and databases, aren’t persisted. So the next time you deploy a change you may be surprised that information is missing.

Thankfully Docker allows you to persist data by means of a mounted virtual drive. The next time your container is created, the mounted drive will be attached and the data will exist again in the container. Since the drive is mounted to a path, you might have to take that into consideration when integrating it into your application. For more information on persisting data, have a look at Docker’s documentation.

The recommended way is to use volumes.

Email Notifications

Never miss a post again! Get my latest articles delivered directly to your inbox and be the first to know about my upcoming course!

Email Notifications

Never miss a post again! Get my latest articles delivered directly to your inbox and be the first to know about my upcoming course!

🙏

Great Choice!

Thanks for enabling notifications! Don’t worry, I hate spam too and I won’t ever disclose your contact information to 3rd parties.