fixing syntax

This commit is contained in:
Ric Harvey
2015-01-27 17:59:28 +00:00
parent 799ae11d0d
commit 383e49fc34

View File

@@ -10,7 +10,7 @@ Pull the image from the docker index rather than downloading the git repo. This
```bash ```bash
docker pull richarvey/nginx-pfp-fpm:latest docker pull richarvey/nginx-pfp-fpm:latest
``` ```
#Running # Running
To simply run the container: To simply run the container:
```bash ```bash
@@ -18,13 +18,13 @@ sudo docker run --name nginx -p 8080:80 -d richarvey/nginx-php-fpm
``` ```
You can then browse to http://<docker_host>:8080 to view the default install files. You can then browse to http://<docker_host>:8080 to view the default install files.
##Volumes ## Volumes
If you want to link to your web site directory on the docker host to the container run: If you want to link to your web site directory on the docker host to the container run:
```bash ```bash
sudo docker run --name nginx -p 8080:80 -v /your_code_directory:/usr/share/nginx/html -d richarvey/nginx-php-fpm sudo docker run --name nginx -p 8080:80 -v /your_code_directory:/usr/share/nginx/html -d richarvey/nginx-php-fpm
``` ```
##Pulling code from git ## Pulling code from git
One of the nice featires of this container is its ability to pull code from a git repository with a couple of enviromental variables passed at run time. One of the nice featires of this container is its ability to pull code from a git repository with a couple of enviromental variables passed at run time.
**Note:** You need to have your SSH key that you use with git to enable the deployment. I recommend using a special deploy key per project to minimise the risk. **Note:** You need to have your SSH key that you use with git to enable the deployment. I recommend using a special deploy key per project to minimise the risk.
@@ -39,7 +39,7 @@ To pull a repository and specify a branch add the GIT_BRANCH environment variabl
```bash ```bash
sudo docker run -e 'GIT_REPO=git@git.ngd.io:ngineered/ngineered-website.git' -e 'GIT_BRANCH=stage' -v /opt/ngddeploy/:/root/.ssh -p 8080:80 -d richarvey/nginx-php-fpm sudo docker run -e 'GIT_REPO=git@git.ngd.io:ngineered/ngineered-website.git' -e 'GIT_BRANCH=stage' -v /opt/ngddeploy/:/root/.ssh -p 8080:80 -d richarvey/nginx-php-fpm
``` ```
##Linking ## Linking
Linking to containers also exposes the linked container environment variables which is useful for configuring web apps: Linking to containers also exposes the linked container environment variables which is useful for configuring web apps:
Run MySQL container with some extra details: Run MySQL container with some extra details:
@@ -68,10 +68,9 @@ To link the container launch like this:
```bash ```bash
sudo docker run -e 'GIT_REPO=git@git.ngd.io:ngineered/ngineered-website.git' -v /opt/ngddeploy/:/root/.ssh -p 8080:80 --link some-mysql:mysql -d richarvey/nginx-php-fpm sudo docker run -e 'GIT_REPO=git@git.ngd.io:ngineered/ngineered-website.git' -v /opt/ngddeploy/:/root/.ssh -p 8080:80 --link some-mysql:mysql -d richarvey/nginx-php-fpm
``` ```
# Special Features
#Special Features ## Templating
##Templating
This container will automatically configure your web application if you template your code. For example if you are linking to MySQL like above, and you have a config.php file where you need to set the MySQL details include $$_MYSQL_ENV_MYSQL_DATABASE_$$ style template tags. Example: This container will automatically configure your web application if you template your code. For example if you are linking to MySQL like above, and you have a config.php file where you need to set the MySQL details include $$_MYSQL_ENV_MYSQL_DATABASE_$$ style template tags. Example:
```php ```php
@@ -81,8 +80,7 @@ database_host = $$_MYSQL_PORT_3306_TCP_ADDR_$$;
... ...
?> ?>
``` ```
## Using environment variables
##Using environment variables
If you want to link to an external MySQL DB and not using linking you can pass variables directly to the container that will be automatically configured by the container. If you want to link to an external MySQL DB and not using linking you can pass variables directly to the container that will be automatically configured by the container.
Example: Example:
@@ -109,5 +107,5 @@ database_pass = $$_MYSQL_PASS_$$
?> ?>
``` ```
##Template anything ## Template anything
Yes ***ANYTHING***, any variable exposed by a linked container or the **-e** flag lets you template your config files. This means you can add redis, mariaDB, memcache or anything you want to your application very easily. Yes ***ANYTHING***, any variable exposed by a linked container or the **-e** flag lets you template your config files. This means you can add redis, mariaDB, memcache or anything you want to your application very easily.