Change:
I found this while working on using the same standard redis image for both the master and the salve. While the master pod is content with the image's defaults, the slave needs the master's address and port. One way of doing this is by overriding the image's CMD to add in the pod template. Assuming and are the env variables defined by kubernetes. This, however, will only work if the command is passed to docker as a string to run it under (which is the only easy way — right? — for the executable to have the substituted values for the env vars supplied). Using the array based command executes it without shell, where these env vars are not substituted and the slave is passed "" and "" directly as strings. From the docker docs: Pull request depends on this.
This is a good issue. I don't see an easier way to make the join you;re describing without bouncing through the shell or doing text subst ourselves (which we really don't want to do). Can anyone see any better way to do this?
I figured out a legitimate workaround.
This would be good in a FAQ somewhere.

Discussion:
<ins> FROM brendanburns/php ADD index.php /var/www/index.php ADD controllers.js /var/www/controllers.js ADD index.html /var/www/index.html CMD /run.sh </ins>

<ins> var redisApp = angular.module('redis', ['ui.bootstrap']); /** * Constructor */ function RedisController() {} RedisController.prototype.onRedis = function() { this.scope_.messages.push(this.scope_.msg); this.scope_.msg = ""; var value = this.scope_.messages.join(); this.http_.get("/index.php?cmd=set&key=messages&value=" + value) .success(angular.bind(this, function(data) { this.scope_.redisResponse = "Updated."; })); }; redisApp.controller('RedisCtrl', function ($scope, $http, $location) { $scope.controller = new RedisController(); $scope.controller.scope_ = $scope; $scope.controller.location_ = $location; $scope.controller.http_ = $http; $scope.controller.http_.get("/index.php?cmd=get&key=messages") .success(function(data) { console.log(data); $scope.messages = data.data.split(","); }); }); </ins>

<ins> <html ng-app="redis"> <head> <title>Guestbook</title> <link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css"> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.12/angular.min.js"></script> <script src="/controllers.js"></script> <script src="ui-bootstrap-tpls-0.10.0.min.js"></script> </head> <body ng-controller="RedisCtrl"> <div style="width: 50%; margin-left: 20px"> <h2>Guestbook</h2> <form> <fieldset> <input ng-model="msg" placeholder="Messages" class="form-control" type="text" name="input"><br> <button type="button" class="btn btn-primary" ng-click="controller.onRedis()">Submit</button> </fieldset> </form> <div> <div ng-repeat="msg in messages"> {{msg}} </div> </div> </div> </body> </html> </ins>

<ins> <? set_include_path('.:/usr/share/php:/usr/share/pear:/vendor/predis'); error_reporting(E_ALL); ini_set('display_errors', 1); require 'predis/autoload.php'; if (isset($_GET['cmd']) === true) { header('Content-Type: application/json'); if ($_GET['cmd'] == 'set') { $client = new PredisClient([ 'scheme' => 'tcp', 'host'   => getenv('SERVICE_HOST'), 'port'   => getenv('REDISMASTER_SERVICE_PORT'), ]); $client->set($_GET['key'], $_GET['value']); print('{"message": "Updated"}'); } else { $read_port = getenv('REDISMASTER_SERVICE_PORT'); if (isset($_ENV['REDISSLAVE_SERVICE_PORT'])) { $read_port = getenv('REDISSLAVE_SERVICE_PORT'); } $client = new PredisClient([ 'scheme' => 'tcp', 'host'   => getenv('SERVICE_HOST'), 'port'   => $read_port, ]); $value = $client->get($_GET['key']); print('{"data": "' . $value . '"}'); } } else { phpinfo(); } ?> </ins>

<ins> FROM dockerfile/redis ADD run.sh /run.sh RUN chmod a+x /run.sh CMD /run.sh </ins>

<ins> #!/bin/bash redis-server --slaveof $SERVICE_HOST $REDISMASTER_SERVICE_PORT </ins>