kantver - Fotolia
When it comes to the world of containers, scalability is key. In previous articles we have covered many different components of the VMware Photon Platform, its uses and how it can be used to provide elastic scale capability in a well-defined and managed environment. With all of Photon's merits, you might be wondering why anyone would bother to put the time into using Docker microservices instead.
To this day, I still see servers that are massively over specified, about 95% of the time, except for traffic spikes that last for a few weeks and then drop off the radar; this equates to thousands of dollars of wastage. Although a Docker microservices setup isn't a magic fix to this problem, it can certainly make a dent by reducing server specification and subsequently lowering costs.
Finding the right fit for Docker microservices
Docker isn't a one size fits all format, as developing a full Docker service that is both reliable and works as intended takes time. For this reason, Docker isn't a proper fit for small one-off servers or applications in general. If you don't need to scale or don't develop in house, Docker can create more issues than it solves. To gauge whether or not Docker is the right fit for your organization, there are a few things DevOps consumers should keep in mind.
First and foremost, getting a Docker image up and running should not require manual interaction; everything should be hands-off. If necessary, you can use the CMD command to run images. Since these machines have a finite life span, they should not hold stateful data. Instead, data should be written to persistent disk storage such as a database or a permanent file system.
Reverting between Docker builds and Dockerfiles
Using appropriate version control is a must. Although my previous article didn't cover using version control for Dockerfile, you need to be able to consistently revert to previous Docker builds and Dockerfiles across environments. To do so, you can use free offerings such as Git or Mercurial, or you can use an online version.
Be mindful when using the latest tag. If you build images using source files that you don't control, using the latest tag in your Dockerfile can result in a slightly different build each time you create your image from scratch. You should likewise use tags judiciously. In a highly automated, frequently changing environment, you may need to have several versions for rollback and quality assurance builds and branches.
You can use the CMD command to automate starting a service. If you need access on a runtime basis, override it with the –ti /bin/bash command.
Looking at log files is easier than you think. If you want to see what your Docker instance is reporting, use the docker log <container> command to export all the logs to the local console. This can come in handy when debugging or if you just want to check in. Similarly, you can log in to a running container by using the command docker attach <container> to work with it interactively.
The aforementioned "hands-off" rule also applies to setting up Photon, because management is best left to the server-based system. Although it remains to be seen what shape Photon bare-metal hosts will take in the new microservices world, odds are it will be similar to the current method, which uses VMware profiles combined with Preboot Execution Environment and Kickstart for deployment.
Keep your Docker microservice deployment simple
While Docker may be easy come, easy go in regards to running instances, you must ensure there are an adequate number of instances running to serve the requirements of the application at any given time. In the event of a failure, other instances should be available. This can be managed with technologies such as Swarm for clustering and Zookeeper, which guarantees that an instance is running on each host.
Deploying Docker hosts to scale as required should be equally as simple. On the VMware platform, this means managing Photon to auto-deploy as required.
There is no doubt that Docker requires up-front investment, load balancing, instance management and build configuration management. Docker microservices can save or cost a small fortune, depending on whether it is used correctly or incorrectly. Ultimately, it's up to consumers to determine whether or not it is a good fit for their environment.
The top Docker tips of 2015
Enterprise options for big data infrastructure
VMware builds its own microservices architecture