Code release for Drupal on lxc containers (vagrant & docker)

Submitted by ricardo on Tue, 08/20/2013 - 14:52

I announced in my last post the availability of actual running code for deploying Drupal sites on LXC containers.
First work acomplished went using puppet & vagrant to create the LXC image. After that it can be exported to a Docker container and moved around.
Since then i went a bit further and created the actual lamp stack with the native docker build ALSO!

1 - So here is the vagrant lxc build (to import to docker):

root@workbox:~# mkdir work
root@workbox:~# cd work
root@workbox:~/work# git clone
Cloning into 'drupal-lxc-vagrant-docker'...
remote: Counting objects: 1976, done.
remote: Compressing objects: 100% (1756/1756), done.
remote: Total 1976 (delta 128), reused 1976 (delta 128)
Receiving objects: 100% (1976/1976), 3.58 MiB | 419 KiB/s, done.
Resolving deltas: 100% (128/128), done.
root@workbox:~/work# cd drupal-lxc-vagrant-docker
root@workbox:~/work/drupal-lxc-vagrant-docker# time vagrant up --provider=lxc
(..redundant output...)
Notice: /Stage[main]/Nginx::Service/Service[nginx]: Triggered 'refresh' from 4 events
Info: Creating state file /var/lib/puppet/state/state.yaml
Notice: Finished catalog run in 113.11 seconds
[default] Running provisioner: shell...
[default] Running: inline script
real 2m9.505s
user 0m4.668s
sys 0m1.852s

lxc is running and Drupal is responding:

root@workbox:~/work/drupal-lxc-vagrant-docker# lxc-ls --fancy
drupal-lxc-vagrant-docker_default-1377001722 RUNNING - NO
# curl -sI -H "Host: drupal"
HTTP/1.1 302 Moved Temporarily
Server: nginx/1.4.2
Date: Tue, 20 Aug 2013 12:48:50 GMT
Content-Type: text/html
Connection: keep-alive
X-Powered-By: PHP/5.4.9-4ubuntu2.2
Location: http://drupal/install.php
Cache-Control: no-cache

2 - ...and now for the direct docker build for Drupal deployment:

root@workbox:~/work# git clone
Cloning into 'docker-drupal'...
remote: Counting objects: 14, done.
remote: Compressing objects: 100% (11/11), done.
remote: Total 14 (delta 2), reused 10 (delta 2)
Unpacking objects: 100% (14/14), done.
root@workbox:~/work/docker-drupal# time docker build -t docker/drupal .
Uploading context 143360 bytes
Step 1 : FROM ubuntu:latest
---> 8dbd9e392a96
(..redundant output...)
---> 0d80be7aa518
Step 17 : EXPOSE 80
---> Running in 673f35f07d35
---> 3d4017267e1a
Step 18 : CMD ["/bin/bash", "/"]
---> Running in 302c024e7d8b
---> 4a9b595415ad
Successfully built 4a9b595415ad
real 0m56.331s
user 0m0.056s
sys 0m0.044s

And start it....

root@workbox:~/work/docker-drupal# sudo docker run -d -t -p 80:80 docker/drupal
root@workbox:~/work/docker-drupal# docker ps
70a6ae328d0e docker/drupal:latest /bin/bash / 6 seconds ago Up 5 seconds 80->80
curl -sI http://localhost -H "Host: drupal"
HTTP/1.1 200 OK
Date: Tue, 20 Aug 2013 12:50:27 GMT
Server: Apache/2.2.22 (Ubuntu)
X-Powered-By: PHP/5.4.9-4ubuntu2
Expires: Sun, 19 Nov 1978 05:00:00 GMT
Last-Modified: Tue, 20 Aug 2013 12:50:27 +0000
Cache-Control: no-cache, must-revalidate, post-check=0, pre-check=0
ETag: "1377003027"
Content-Language: en
X-Generator: Drupal 7 (
Vary: Accept-Encoding
Content-Type: text/html; charset=utf-8

Here are the 2 repos if you would like to try it yourself or even contribute:

1 -
2 -

Powered by Drupal