Category Archives: beanstalkd

Dockerfile, apache and beanstalkd in the same container

I'm trying to launch apache and beanstalkd in the same dockerfile :

FROM davidgaya/apache-php-oci:latest

# Update aptitude with new repo
RUN apt-get update && apt-get install -y \
    git \
    acl \
    beanstalkd

EXPOSE 11300

CMD ["/usr/bin/beanstalkd"]

ADD my-api /app/my-api

WORKDIR /app/my-api

RUN composer config --global github-protocols https

RUN curl -sS https://getcomposer.org/installer | php

RUN rm -rf var/cache/* var/logs/* var/sessions/*

RUN HTTPDUSER=`ps axo user,comm | grep -E '[a]pache|[h]ttpd|[_]www|[w]ww-data|[n]ginx' | grep -v root | head -1 | cut -d\  -f1`

RUN setfacl -R -m u:"$HTTPDUSER":rwX -m u:`whoami`:rwX app/cache

RUN setfacl -dR -m u:"$HTTPDUSER":rwX -m u:`whoami`:rwX app/cache

RUN mv composer.phar /usr/local/bin/composer

RUN rm -rf app/cache/*

RUN php /usr/local/bin/composer install

When i build my container and run it, i cannot access to my apache server, because beanstalk seems to stop it.

If i build and run my docker file, and connect into it with bash, apache is not working :

[email protected]:/app/webservice-api# lsof -i
COMMAND   PID USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
beanstalk   1 root    3u  IPv4  64990      0t0  TCP *:11300 (LISTEN) 

but when i do service apache2 start and after that lsof -i i found :

beanstalk   1 root    3u  IPv4  64990      0t0  TCP *:11300 (LISTEN)
apache2    38 root    4u  IPv6  65407      0t0  TCP *:http (LISTEN)

and after that i can access to apache.

What wrong with my docker file ? how can i fix it to launch apache and beanstalk at the same time ?

Thank you