This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.
Dockerized OctoberCMS on Vagrant
If you're interested in containers and wanted to play with OctoberCMS, it's pretty simple to get started once you have Docker installed. I've posted a trusted OctoberCMS build and Dockerfile is available on Github. Using this short guide will let you have OctoberCMS up and running with a near zero efforts.
Docker introduction for the rest of us who are not there
Linux containers (LXC) and Docker on top of this technology is an approach to have consistent and scalable environment which can be easily deployed anywhere and stay consistent. Containers as well as a full virtualized system give you a resource isolation (cpu, memory, processes, OS environment) but require less resources. It is also uses layered AuFS which allows you to share the common parts of the operating system between containers and write changes only for a specific container. Docker containers support versioning in a way that could be described as "Docker is to deployment as Git is to development".
You can use LXC and Docker with all modern Linux distributions and it suns smoothly on public cloud services like EC2/Rackspace/DigitalOcean/etc or bare-metal. And there is no difference.
Docker Getting Started and Installation guides is an entry point for everybody to get on track.
Installation using Vagrant
In this guide I will be using Ubuntu 12.04 (x64) on Vagrant to show how to install Docker and run prebuild docker image (OctoberCMS) on top of it.
First of all go to download and install VirtualBox and Vagrant for your platform to build our host machine for Docker.
$ sudo vagrant init hashicorp/precise64 # will download and install vagrant image for Ubuntu 12.04 (x64)
# It will create Vagrantfile in current directory.
# *Do not forget* to uncomment *config.vm.network "public_network"* for bridge access from local network to host machine.
# Ready to start our host server.
$ sudo vagrant up # run the virtual machine
# Choose your internet network interface for bridge access
$ sudo vagrant ssh # login to our new host system
Welcome to Ubuntu 12.04 LTS (GNU/Linux 3.2.0-23-generic x86_64)
* Documentation: https://help.ubuntu.com/
Welcome to your Vagrant-built virtual machine.
Last login: Fri Sep 14 06:23:18 2012 from 10.0.2.2
vagrant@precise64:~$
Follow the Docker installation guide for Ubuntu 12.04.
$ sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9
$ sudo apt-get update
$ sudo apt-get install -y linux-image-generic-lts-raring linux-headers-generic-lts-raring
$ sudo reboot # into new kernel
# Use "vagrant ssh" to login back and install docker from repository
$ sudo apt-get install -y curl && curl -s https://get.docker.io/ubuntu/ | sudo sh
Run OctoberCMS image from docker registry
It is very easy to run a container using prebuild image from public docker registry. Initial downloads will take some time. Good time for a coffee break!
$ sudo docker run -p 80 -p 22 -p 3306 -d alexeymasolov/docker-octobercms-nginx-ssh
# -p Ports to map from container to local ports
# alexeymasolov/docker-octobercms-nginx-ssh - trusted build of octobercms
Please make sure it is running by using docker ps command
$ sudo docker ps -a
From the output you can see ports mapping 0.0.0.0:49153->22/tcp, 0.0.0.0:49154->3306/tcp, 0.0.0.0:49155->80/tcp Fire up your browser and go to http://your-vagrant-IP:49155/ to enjoy OctoberCMS!
You can get Vagrant's IP by using ifconfig
$ ifconfig eth1
eth1 Link encap:Ethernet HWaddr 08:00:27:4f:c4:c7
inet addr:192.168.1.7 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::a00:27ff:fe4f:c4c7/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:1641 errors:0 dropped:0 overruns:0 frame:0
TX packets:2001 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:199305 (199.3 KB) TX bytes:2850888 (2.8 MB)
Build your own OctoberCMS docker image
To buid your own docker image and use it for deployment follow instructions on GitHub
Last updated
Hi Alexey, what do you think about these scripts for basic provisioning? https://github.com/ebussola/oc-docker
Hi, 2 questions:
- Is it up to date?
- I don't see any volume mapping in a docker file. I assume those should exist to preserve database?
1-3 of 3