diff --git a/composer/README.md b/composer/README.md index 2cd9b2cdb..ee2f7cbaf 100644 --- a/composer/README.md +++ b/composer/README.md @@ -58,15 +58,13 @@ You can read more about Composer in our [official documentation](https://getcomp ### Basic usage -Running the `composer` image is as simple as follows: - ```console $ docker run --rm --interactive --tty \ --volume $PWD:/app \ - composer install + composer ``` -### Persistent cache / global configuration +### Persist cache / global configuration You can bind mount the Composer home directory from your host to the container to enable a persistent cache or share global configuration: @@ -74,12 +72,12 @@ You can bind mount the Composer home directory from your host to the container t $ docker run --rm --interactive --tty \ --volume $PWD:/app \ --volume ${COMPOSER_HOME:-$HOME/.composer}:/tmp \ - composer install + composer ``` **Note:** this relies on the fact that the `COMPOSER_HOME` value is set to `/tmp` in the image by default. -Or if you are following the XDG specification: +Or if your environment follows the XDG specification: ```console $ docker run --rm --interactive --tty \ @@ -88,7 +86,7 @@ $ docker run --rm --interactive --tty \ --volume ${COMPOSER_HOME:-$HOME/.config/composer}:$COMPOSER_HOME \ --volume ${COMPOSER_CACHE_DIR:-$HOME/.cache/composer}:$COMPOSER_CACHE_DIR \ --volume $PWD:/app \ - composer install + composer ``` ### Filesystem permissions @@ -99,9 +97,13 @@ By default, Composer runs as root inside the container. This can lead to permiss $ docker run --rm --interactive --tty \ --volume $PWD:/app \ --user $(id -u):$(id -g) \ - composer install + composer ``` +See: https://docs.docker.com/engine/reference/run/#user for details. + +> Note: Docker for Mac behaves differently and this tip might not apply to Docker for Mac users. + ### Private repositories / SSH agent When you need to access private repositories, you will either need to share your configured credentials, or mount your `ssh-agent` socket inside the running container: @@ -112,12 +114,12 @@ $ eval $(ssh-agent); \ --volume $PWD:/app \ --volume $SSH_AUTH_SOCK:/ssh-auth.sock \ --env SSH_AUTH_SOCK=/ssh-auth.sock \ - composer install + composer ``` **Note:** On OSX this requires Docker For Mac v2.2.0.0 or later, see [docker/for-mac#410](https://github.com/docker/for-mac/issues/410). -When combining the use of private repositories with running Composer as another user, you might run into non-existent user errors (thrown by ssh). To work around this, simply mount the host passwd and group files (read-only) into the container: +When combining the use of private repositories with running Composer as another user, you can run into non-existent user errors (thrown by ssh). To work around this, bind mount the host passwd and group files (read-only) into the container: ```console $ eval $(ssh-agent); \ @@ -128,7 +130,7 @@ $ eval $(ssh-agent); \ --volume /etc/group:/etc/group:ro \ --env SSH_AUTH_SOCK=/ssh-auth.sock \ --user $(id -u):$(id -g) \ - composer install + composer ``` # Troubleshooting @@ -156,7 +158,7 @@ Suggestions: "config": { "platform": { "php": "MAJOR.MINOR.PATCH", - "ext-something": "1" + "ext-something": "MAJOR.MINOR.PATCH" } } } diff --git a/perl/README.md b/perl/README.md index c12908084..0d747ace7 100644 --- a/perl/README.md +++ b/perl/README.md @@ -147,7 +147,7 @@ RUN cpanm Carton \ && mkdir -p /usr/src/app WORKDIR /usr/src/app -ONBUILD COPY cpanfile* /usr/src/myapp +ONBUILD COPY cpanfile* /usr/src/app ONBUILD RUN carton install ONBUILD COPY . /usr/src/app