Use Docker To Speed Up Development

Use Docker To Speed Up Development

Introduction

Docker is an indispensable tool during development when it comes to quickly setting up a service for testing. There are many Docker images to choose from on both GitHub and Docker’s official repository. In this blog post, we will show you some of our favorite Docker images that we use daily.

  1. Database: postgres
  2. E-mail: rnwood/smtp4dev
  3. VMware vCenter: vmware/vcsim

Database: postgres

PostgreSQL is a database management system. While setting up a PostgreSQL instance in a virtual machine may not be difficult, doing so with Docker is much more efficient and it provides the additional benefits of being able to spin up and tear down an instance with just a few keystrokes.

To launch a PostgreSQL Docker container, you will need to provide Docker the following information:

  1. POSTGRES_PASSWORD: Password to access the container

Furthermore, username and default database which will be created during container initialization can also be specified.

  1. POSTGRES_USER: Specified value will override the default username “postgres”.
  2. POSTGRES_DB: Specified value will be used to create the default database during container initialization.

The following command launches a PostgreSQL Docker container with minimal customization:

docker run --rm –d -p 5432:5432 -e POSTGRES_PASSWORD=mysecretpassword postgres:15.3

More information can be found here.

E-mail: rnwood/smtp4dev

Our product is able to deliver e-mails to notify operators when a monitor violates its condition. Users are able to specify criteria, for example when and who. With the help of rnwood/smtp4dev, we are able to test changes to email locally.

rnwood/smtp4dev is an SMTP server written in C# and Vue.js. It provides an SMTP server and a web front end to view received e-mails. In the front end, we can inspect mail headers as well, which can be useful for debugging.

The following command starts an instance of rnwood/smtp4dev running SMTP on port 2525 and web front end on port 8080:

docker run --rm -d -p 2525:25 -p 8080:80 rnwood/smtp4dev

More information can be found here.

VMware vCenter: vmware/vcsim

ThirdEye offers the ability to monitor VMware vCenter and virtual machines hosted in it. It’d be dangereous to test changes against a production vCenter instance since it is possible to wipe out the entire data center due to a bad change. Not to mention that it is costly to set up a vCenter instance just for the purpose of testing. Therefore, we chose vmware/vcsim for testing.

vmware/vcsim is a vCenter simulator developed by the developer and owner VMware. It provides API endpoints that are same as what a production instance would provide. Setting it up is easy and quick, you just run the following command:

docker run --rm -d -p 8989:8989 vmware/vcsim:v0.30.5

An instance will be available at port 8989 of your machine.

More information on the Docker image can be found on here.

Conclusion

In this blog post, we looked at some Docker images which we use daily. We also looked at how to get the services up and running. They are easy to set up and provide us with access to services that would otherwise be time-consuming to set up.

Image: VollwertBIT