Installing CPhalcon on an AWS Docker image

I have a docker image that installs phalcon onto a Docker image. Here is the Dockerfile:

FROM ubuntu:trusty
MAINTAINER Fernando Mayo <>, Feng Honglin <>

# Install packages
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update && \
  sudo apt-get -y install supervisor php5-dev libpcre3-dev gcc make php5-mysql git curl unzip apache2 libapache2-mod-php5 mysql-server php5-mysql pwgen php-apc php5-mcrypt php5-curl && \
  echo "ServerName localhost" >> /etc/apache2/apache2.conf

# Add image configuration and scripts
RUN chmod 755 /*.sh
ADD my.cnf /etc/mysql/conf.d/my.cnf
ADD supervisord-apache2.conf /etc/supervisor/conf.d/supervisord-apache2.conf
ADD supervisord-mysqld.conf /etc/supervisor/conf.d/supervisord-mysqld.conf
ADD php.ini /etc/php5/cli/php.ini
ADD 000-default.conf /etc/apache2/sites-available/000-default.conf

ADD 30-phalcon.ini /etc/php5/apache2/conf.d/30-phalcon.ini
ADD 30-phalcon.ini /etc/php5/cli/conf.d/30-phalcon.ini

#RUN rm -rd /var/www/html/*
#RUN git clone --depth=1 git:// /var/www/html/cphalcon
#RUN chmod 755 /var/www/html/cphalcon/build/install

RUN git clone --depth=1 git:// /usr/local/src/cphalcon
RUN cd /usr/local/src/cphalcon/build && ./install ;\
    echo "" > /etc/php5/mods-available/phalcon.ini ;\
    php5enmod phalcon

RUN sudo service apache2 stop
RUN sudo service apache2 start

# Remove pre-installed database
RUN rm -rf /var/lib/mysql/*

# Add MySQL utils
RUN chmod 755 /*.sh

# config to enable .htaccess
RUN a2enmod rewrite

# Copy over private key, and set permissions
ADD .ssh /root/.ssh

# Get aws stuff
RUN curl "" -o ""
RUN unzip
RUN ./awscli-bundle/install -i /usr/local/aws -b /usr/local/bin/aws

RUN rm -rd /var/www/html/*
RUN git clone ssh:// /var/www/html

#Environment variables to configure php

# Add volumes for MySQL 
VOLUME  ["/etc/mysql", "/var/lib/mysql" ]

EXPOSE 80 3306
CMD ["/"]

When I run this Docker image locally it works fine, but when I run it on Elastic Beanstalk I get the error: PHP Fatal error: Class ‘Phalcon\Loader’ not found. To debug this I checked phpinfo() both locally and on the AWS server. Locally it shows all of the phalcon files installed, but on AWS I don’t get any info about CPhalcon. How could the Docker image install Phalcon correctly when running on my local machine but not on Elastic Beanstalk?

  • Docker - Access mapr UI from host
  • Docker reserve a certain amount of memory for container
  • How do you add a volume to a container in the IBM Bluemix Docker cloud?
  • NFS Server on OSX - squash options
  • PhpStorm error with docker volumes: “VirtualBox shared folders should be configured in the Docker cloud settings”
  • Container as volume pattern in windows/vagrant env
  • Why is the official SQL Server Express container only meant for development and testing?
  • Docker Use LXC with Direct Host Networking
  • Is this Dockerfile extending a image or creating a new one ?
  • mount points added to the host don't show up in a running docker container
  • Monitoring MySQL running within a docker container?
  • Can a dockerfile interact with system settings?
  • Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.