Why Docker?

in Development

Most of the courses we teach at Code School are about writing code — but once you’ve learned how to write the code to build websites and web applications, you need to figure out two things:

  1. Setting up your local development environment to support the tools needed to code effectively.
  2. Publishing, or deploying, your code to the web.

Docker is a technology that greatly reduces the effort needed to accomplish both of those tasks, and today we’re launching a new Docker course, Try Docker, to help you learn how to add it to your development workflow.

It can be a little strange at first to understand the value Docker provides, so let’s look at a few specific scenarios where you can incorporate Docker to make your development workflow more efficient.

Containerizing a local development environment

Before you start developing on your computer, you need to spend time downloading and installing a wide variety of development tools. This might be Node, Redis, and MongoDB. Or Python, Django, and MySQL. Or maybe Ruby, Rails, and Postgres, and a bunch of gems. In each scenario, you’ll likely be following quite a few steps before everything is working exactly as you need it to, and it’s almost certain you’ll run into some issues that result in installation taking a lot longer than expected.

With Docker, you can install those components in containers and write up all of the instructions to create an image. Then, when you have that image, with a single command you can start a container that always contains the same version of your codebase and dependencies. If something in the configuration on your computer gets messed up, you could spend a lot of time trying to repair it, but if it’s running in a container, then you don’t have to worry about conflicts on your host operating system affecting your development time.

Deploying your application

Making your application run on your own computer is a huge accomplishment, but as applications get more and more complex, getting your local environment to match up with a production environment on a server can get tricky. Docker can help here too. If your local environment is just Docker running containers, then if you can get Docker running on your production server, those same containers should work there too. There’s support for lots of different cloud servers — like AWS, Azure, and Windows Server — but you can of course configure your own servers with Docker.

Sharing your environment with your team

One of the harder parts of a team working together on an application using the same codebase is standardizing everyone’s development environment. Tools like Git and GitHub have solved the problem of teams sharing the code itself, but prior to containers, many teams used a series of shell scripts to try to configure each other’s machines as closely as possible, or even just instructions in a README file. By creating and sharing Dockerfiles and images with your team, it’s much easier to make sure everyone is working with the same base, and you’ll be free to focus your energy on development time instead of worrying about fixing configuration problems across your team’s computers.

These are just a few of the ways Docker can help developers, and there are similar benefits gained by introducing it into testing and devops workflows. If you’ve heard about Docker but have been putting off learning it because it seems too complicated, then play through our free Try Docker course for a quick and fun introduction to the power of Docker and containers.

Code School

Code School teaches web technologies in the comfort of your browser with video lessons, coding challenges, and screencasts. We strive to help you learn by doing.

Visit codeschool.com

About the Author

Jon Friskics

Content Producer and Developer at Code School. Enjoys building iOS and web apps, and then figuring out the best way to teach people how to build their own.

Might We Suggest