Remote C++ development using Docker
Saturday, December 28, 2019
Every developer has a set of favorite tools and workflows. Syncing these with other team members can be challenging with most stacks. Add C++ to this challenge and things can get out of hand real quick!
Without a package manager, a variety of build tools, a handful of compilers and different implementations of the standard library, it’s a miracle we can get anything done. It’s also not uncommon—if you are looking for trouble—to develop your application on a platform that doesn’t match your deployment target.
One way to address these challenge and incur other benefits in the process is to use Docker.
I’m not going to get into containerization in general or how Docker works. There are plenty of resources online that do just that. Instead, I want to focus on how Docker can help C++ developers build their applications more effectively.
The benefits of using Docker for C++ development are threefold:
- It allows us to keep our development environment in-sync
- It allows us to collaborate more efficiently across our team
- It lets us run and maintain different toolchains on a single machine
Before taking you through a complete example, let’s look at each of these points in detail.
Keeping your development environment in-sync
In C++ portability is not something we bolt on once we’re ready to deploy our application, we have to consider it from the outset, and there are many things to take into account.
If you’re starting out with C++ and you think you can manually keep your development environment in-sync, you will be forgiven, but experience tells a different tale.
As a rule of thumb, we always want to develop our applications using the same environment configuration as our deployment target, but how do we guarantee symmetry without introducing high-costs or complexity? The answer is found in the title of this post.