Drupal Container on IBM Bluemix

Share: Share on FacebookTweet about this on TwitterShare on Google+Share on LinkedInShare on RedditEmail this to someonePrint this page



IBM Containers allows for Docker images to run on Bluemix, our cloud platform.  I’d like to share how I was able to run an official Drupal image from DockerHub, run it on the IBM Containers platform within Bluemix, and then connect that Drupal instance to a database service running on Bluemix.

Drupal is a free and open-source content management system (similar to WordPress) that runs on PHP. It is robust and used extensively in enterprise environments. All Drupal sites require a database (click here for more information), and we’d like to support easy integration with our own Bluemix databases: ElephantSQL and ClearDB, a postgreSQL and MySQL database, respectively. 

When Drupal is installing, it asks the user to input the database credentials. Thus, we’ve provided our own Drupal 7 image built off of the official DockerHub image that automatically fills in those credentials for you (an explanation of the code changes can be found here). In order for a Drupal image container to have database credentials and database URL available, you’ll need to bind your container to an app that is itself bound to the desired database (either ElephantSQL or clearDB). The app can be a dummy application running on Bluemix. It doesn’t need to have any real purpose. It just provides the link between the database credentials and the container.

Once you’ve done that, you can begin the installation process. Just be sure to select either the standard or minimal Bluemix installation profile. Otherwise, the installation will be what you’d normally expect, no changes.


Note: this image works for one instance. If you deviate from the tutorial and create another instance, your Drupal site will not work. Additionally, make sure you first have the Docker CLI and the Cloud Foundry CLI with the IBM-Containers plugin. See here under “Setting up the CLI” if you do not have these prerequisites. Whatever virtual machine you use for docker (e.g., boot2docker) should be up and running at this point.

Step 1: Get Namespace (Optional if you’ve used IBM Containers before)

Go to the Bluemix Dashboard and hit “Start Containers” and then hit “Add your own.” You should get to this screen:

Step 2: Log into the CLIs

First login to cloud foundry.

Then login to IBM Containers.

Note: this login may not work immediately if you just created your namespace. Give it a few minutes then try again. You should see “Successfully authenticated with registry.” 

Step 3: Pull the Image

Step 4: Tag the Drupal Image for Pushing up to Your Bluemix Registry

Replace [namespace] with your namespace.

Step 5: Push [namespace]/drupal up to Your Registry

Step 6: Create a Dummy App

Lets head over to Bluemix for the rest of the tutorial. In Bluemix, you will need to create a new application to bind the ClearDB database and container to. It will serve as a link between the container and database. I recommend using the SDK for Node.js runtime from the catalog. So click “Create App,” choose a web app, and select Node.js as seen below:


Make sure to choose a unique name for your app like “[yourUsername]-drupal”.

Step 7: Instantiate a ClearDB Service (ElephantSQL is an option as well)

Once your app is running go ahead and create a ClearDB MySQL Service instance in the catalog:


Bind it to the node.js app we just created. Do not leave the ClearDB service unbound. This application bind is accomplished from the “App” entry field within the “Add Service” section.


Step 8: Create a Container with the Drupal Image

Go on to your Dashboard and select “Start Containers”:

That will take you to the following page:

 Click on the drupal container and then make sure to accurately follow these steps:

  1. Select “Scalable Group” (this is created in steps 1-3)
  2. Put in any “Container Group Name” you want
  3. Make sure to have just 1 instance (won’t work otherwise).
  4. The HTTP port should be 80.
  5. Under “Service Binding” select the app that we created and bound the database to.

The rest can be left as default. It should look like this except using your space and names instead of mine:


Click “Create” and now wait. This can take a while. You’ll know you’re done when your screen looks like this:

Step 8: Drupal Installation

Visit your page clicking the blue URL as seen in the success image in the previous step. Your page should look like this:



As per normal Drupal installation, you must choose a profile. The first two are what come with every Drupal installation and the second two are what you want. They are the same as the first two but configured such that they will automatically fill out the database credentials for you when you hit the “Set up database” phase. If you’re unsure just choose “Bluemix Standard Install” and proceed. After a few clicks of the next button, congratulations, everything should be up and running.

Share: Share on FacebookTweet about this on TwitterShare on Google+Share on LinkedInShare on RedditEmail this to someonePrint this page