Gremlin is a simple, safe and secure way to use Chaos Engineering to improve system resilience. You can use Gremlin with Docker in a variety of ways. It is possible to attack Docker containers and it is also possible to run Gremlin in a container to create attacks against the host or other containers.

This tutorial will provide a walkthrough of the following:

How to install Docker

How to create a htop container to monitor the host and containers

How to create an Nginx Docker container to attack using Gremlin

How to install Gremlin on the host

How to create a CPU Attack from the host against an nginx Docker container using the Gremlin Control Panel

It is possible to install Gremlin on the host or in a Docker container. If you would prefer to install Gremlin in a Docker container view the guide, How to Install and Use Gremlin in a Docker Container on Ubuntu 16.04.

The “Hello World” of Chaos Engineering is the CPU Resource Attack. To create a CPU Resource Attack select “Resource” and then “CPU” in the dropdown menu.

The CPU Resource Attack will consume CPU resources based on the settings you select. The most popular default settings for a CPU Resource Attack are pre-selected, a default attack will utilize 1 core for 60 seconds. Before you can run the Gremlin attack you will need to click either Exact hosts to run the attack on or click the Random attack option.

Click Exact and select the host you created the nginx Docker container on, in this example that is 138.68.226.195.

If you have the Gremlin Slackbot enabled you will also see the bot post that the Gremlin Attack has started. When it’s successful the Gremlin Slackbot will post again. To setup the Gremlin Slackbot follow the guide, How to Setup and Use the Gremlin Slackbot.

When your attack is finished it will move to Completed Attacks in the Gremlin Control Panel.

To view the logs of the Attack, click on the Attack in Completed Attacks then click to the arrow to view the logs.

You’ve installed Gremlin on a server running Docker and validated that Gremlin works by running the “Hello World” of Chaos Engineering for Docker Containers, the CPU Resource attack. You now possess tools that make it possible for you to explore additional Gremlin Attacks including attacks that impact State and Network.

Gremlin’s Developer Guide is a great resource and reference for using Gremlin to do Chaos Engineering. You can also explore the Gremlin Blog for more information on how to use Chaos Engineering with your application infrastructure.