Public Repository

Last pushed: 2 years ago
Short Description
Image for data containers proper to be mounted for symfony applications development.
Full Description

This image prepares a volume at /var/www/symfony and launchs an script to change www-data uid/gid to be aligned with that of the host user mounting its developing dir at the host to /var/www/symfony at the container.

Typical use case:

$:~/my-git-clone-dir>docker pull alianza/symfony-app
$:~/my-git-clone-dir>ls -ldn .
drwxrwxr-x 76 10001 0 4096 feb  4 14:06 .
$:~/my-git-clone-dir>docker run -d -v $(pwd):/var/www --name code-container \\
 -e USERID=10001 alianza/symfony-app

This runs a container with a /var/www/symfony dir with contents mounted from the working dir at the host. Owner and group for dir and files www-data at the container. If USERID is not specified the container will use 1000 as it is a reasonable debian default (first non root user created has 1000 as uid/gid).

Files for building this image:


FROM debian:wheezy

VOLUME /var/www/symfony

## www-data user config script
COPY /usr/bin/

CMD /usr/bin/ && tail -f /dev/null (755 permissions on the host):

## Don't attempt to run if we are not root
if [ "$EUID" -ne 0 ]
    then echo "Please run as root"

## Set defaults for environmental variables in case they are undefined

## (Docker cares only about uid, not username; diff users with same uid = confusion)
echo "Changing www-data uid&gid from 33 to $USERID"

groupmod -g $USERID www-data
usermod -u $USERID -g $USERID www-data
Docker Pull Command

Comments (0)