Running Docker containers
Now that we have the two base Docker files that we need, let’s create an example PHP program that we can use to make sure that our containers are working as expected.
Create a phptdd/codebase/index.php
PHP file, like so:
<?php $dbHost = "server-mysql"; $dbUsername = "root"; $dbPassword = "mypassword"; $dbName = "mysql"; try { $conn = new PDO("mysql:host=$dbHost;dbname=$dbName", $dbUsername, $dbPassword); $conn->setAttribute(PDO::ATTR_ERRMODE, PDO:: ERRMODE_EXCEPTION); echo "MySQL: Connected successfully"; } catch(PDOException $e) { &...