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?

  • How to run google chrome headless in docker?
  • Can I restart a docker container from within the container terminal?
  • Dynamically Pull Docker Image using chef recipe
  • How to run Python Scripts on Windows using Docker with Tensorflow
  • How do I uninstall docker-compose?
  • Docker-compose: flag -p equivalence
  • @EnableDiscoveryClient spring Boot service registration
  • docker pull gets me the error: “Download failed, retrying: x509: certificate signed by unknown authority”
  • container running but cannot be visited in browser
  • Mounting AWS EBS volume when launching VM with Docker Machine
  • PostgreSQL Docker installation how to setup initial database
  • How to arrange web application docker containers in production stage
  • Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.