Image for post
Image for post

Docker the Hard Way: Part 3

More Solutions for Orchestrating WordPress-MySQL containers

In a previous article I detailed a solution using simple shell script to orchestrate launching WordPress and MySQL 5.7 containers.

Previous Articles

The Problem Defined

The Solution with Shell Script

The Solution in Python

Python is extremely popular, so I started with a solution in that language. This requires Python 3.6 or higher for the new f-string feature.

  • matching with in operator
num = 5
word = 'howdy'
string = f"""
A number = {num}
A word = {word}
"""
num = 5
word = 'howdy'
string = """
A number = {}
A word = {}
""".format(num,word)

The Solution in Ruby

Ruby is still quite popular for system administration chores, so here is that solution:

  • matching is simple with match operator =~ or not-match operator !~
  • interpolation of variables or methods is simple with "#{var}"
  • global substitution with gsub() method from any string, including here-string.
  • defaulting variables with var = ENV['VAR'] || 'default_value'

The Solution in Perl

And we wouldn’t be complete, if we could not at least peek at Perl, if for not other reason to compare and contrast to others.

  • matching is simple with match operator =~ or not-match operator !~
  • interpolation of variables or methods is simple with "$var"
  • global substitution similar to sed with $var =~ s/pattern/replace/g;.
  • defaulting variables with $var = ENV{'VAR'} || 'default_value';

Wrapping Up

There you have it, three languages (Python, Ruby, Perl), four if you include the shell script solution from previous article.

Written by

Linux NinjaPants Automation Engineering Mutant — exploring DevOps, Kubernetes, CNI, IAC

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store