Giter Site home page Giter Site logo

composer / docker Goto Github PK

View Code? Open in Web Editor NEW
252.0 12.0 129.0 338 KB

Composer in Docker

Home Page: https://hub.docker.com/_/composer/

License: MIT License

Shell 22.29% Dockerfile 77.71%
docker composer php dependency-manager package-manager hacktoberfest

docker's Introduction

Docker Images

Source behind the following images:

Docker Hub documentation can be found at https://github.com/docker-library/docs/tree/master/composer

Official Image (Docker Hub only)

The "official" image release workflow is as follows:

Community / Vendor Image

The "community" image release workflow is as follows:

docker's People

Contributors

1ed avatar alcohol avatar derrabus avatar elieliabeuf avatar exussum12 avatar fredden avatar ihor-sviziev avatar j0wi avatar jk2k avatar jnoordsij avatar localheinz avatar mateuszsip avatar michael-careplanner avatar mykiwi avatar nick-zh avatar philosoft avatar rickselby avatar rundfunk avatar seanhamlin avatar seldaek avatar simonhammes avatar t3easy avatar tyranron avatar wirone avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

docker's Issues

composer home directory not writable when running as custom user

When running the Composer image as follows

docker run --rm \
  --volume /etc/passwd:/etc/passwd:ro \
  --volume /etc/group:/etc/group:ro \
  --user $(id -u):$(id -g) \
  composer install

the default COMPOSER_HOME (/composer) cannot be written to by the user which is used to run the process. Since these Containers are ephemeral and single-run only, I am not sure if having a writable cache is of any use. Regardless, it would be nice to avoid having Composer throw warnings around.

Add Support for ARM64V8 architecture

Hi,

The Composer docker package is building and running fine at my end for ARM64v8 architecture.

Branch used to build is:

1.6

Please suggest, what needs to be done to raise the request to add support for ARM64v8 arch at official docker library too.

Regards,

Error when building with docker on tag 1.8.0

Got this error during a build, let me know if I can provide more info

RUN curl --silent --fail --location --retry 3 --output /tmp/installer.php --url https://raw.githubusercontent.com/composer/getcomposer.org/b107d959a5924af895807021fcef4ffec5a76aa9/web/installer  && php -r "     \$signature = '544e09ee996cdf60ece3804abc52599c22b1f40f4323403c44d44fdfdd586475ca9813a858088ffbc1f233e9b180f061';     \$hash = hash('SHA384', file_get_contents('/tmp/installer.php'));     if (!hash_equals(\$signature, \$hash)) {         unlink('/tmp/installer.php');         echo 'Integrity check failed, installer is either corrupt or worse.' . PHP_EOL;         exit(1);     }"  && php /tmp/installer.php --no-ansi --install-dir=/usr/bin --filename=composer --version=${COMPOSER_VERSION}  && composer --ansi --version --no-interaction  && rm -rf /tmp/* /tmp/.htaccess

Cannot docker-compose up with composer container

Hi! This is My docker-compose.yml:

version:  '2'

volumes:
  database_data:
    driver: local

services:
  nginx:
    image: nginx:latest
    ports:
      - 8080:80
    volumes:
      - ./docker/nginx/default.conf:/etc/nginx/conf.d/default.conf
    volumes_from:
      - php

  php:
    build: ./docker/php/
    expose:
      - 9000
    volumes:
      - .:/var/www/html
    environment:
      XDEBUG_CONFIG: remote_host=192.168.1.40
      PHP_IDE_CONFIG: "serverName=nginx.local"

  mysql:
    image: mysql:latest
    command: --disable-partition-engine-check
    ports:
      - 3306:3306
    expose:
      - 3306
    environment:
      MYSQL_ROOT_PASSWORD: blablabla
      MYSQL_DATABASE: blablabla_db
      MYSQL_USER: blablabla
      MYSQL_PASSWORD: blablabla
    volumes:
        - database_data:/var/lib/mysql

  composer:
    build: ./docker/composer/
    volumes:
      - .:/app

This is the Dockerfile inside ./docker/composer/

FROM php:7-alpine

RUN apk --no-cache add curl git subversion openssh openssl mercurial tini bash zlib-dev

RUN echo "memory_limit=-1" > "$PHP_INI_DIR/conf.d/memory-limit.ini" \
 && echo "date.timezone=${PHP_TIMEZONE:-UTC}" > "$PHP_INI_DIR/conf.d/date_timezone.ini"

RUN docker-php-ext-install zip

ENV COMPOSER_ALLOW_SUPERUSER 1
ENV COMPOSER_HOME /tmp
ENV COMPOSER_VERSION 1.6.3

RUN curl -s -f -L -o /tmp/installer.php https://raw.githubusercontent.com/composer/getcomposer.org/b107d959a5924af895807021fcef4ffec5a76aa9/web/installer \
 && php -r " \
    \$signature = '544e09ee996cdf60ece3804abc52599c22b1f40f4323403c44d44fdfdd586475ca9813a858088ffbc1f233e9b180f061'; \
    \$hash = hash('SHA384', file_get_contents('/tmp/installer.php')); \
    if (!hash_equals(\$signature, \$hash)) { \
        unlink('/tmp/installer.php'); \
        echo 'Integrity check failed, installer is either corrupt or worse.' . PHP_EOL; \
        exit(1); \
    }" \
 && php /tmp/installer.php --no-ansi --install-dir=/usr/bin --filename=composer --version=${COMPOSER_VERSION} \
 && composer --ansi --version --no-interaction \
 && rm -rf /tmp/* /tmp/.htaccess

COPY docker-entrypoint.sh /docker-entrypoint.sh

WORKDIR /app

ENTRYPOINT ["/docker-entrypoint.sh"]

CMD ["composer"]

And i did create the docker-entrypoint.sh inside same directory.

Trying to docker-compose up...
The result is:

D:\Projects\php\manufactory>docker-compose up
Creating manufactory_php_1      ... done
Creating manufactory_composer_1 ...
Creating manufactory_nginx_1    ... done
Creating manufactory_mysql_1    ...
Creating manufactory_mysql_1    ... done
Attaching to manufactory_composer_1, manufactory_php_1, manufactory_nginx_1, manufactory_mysql_1
composer_1  | standard_init_linux.go:195: exec user process caused "exec format error"
php_1       | Failed loading /wherever/you/put/it/xdebug.so:  /wherever/you/put/it/xdebug.so: cannot open shared object file
: No such file or directory
php_1       | [14-Feb-2018 10:18:41] NOTICE: fpm is running, pid 1
php_1       | [14-Feb-2018 10:18:41] NOTICE: ready to handle connections
manufactory_composer_1 exited with code 1
mysql_1     | Traceback (most recent call last):
  File "docker-compose", line 6, in <module>
  File "compose\cli\main.py", line 71, in main
  File "compose\cli\main.py", line 124, in perform_command
  File "compose\cli\main.py", line 975, in up
  File "compose\cli\log_printer.py", line 105, in run
  File "compose\cli\log_printer.py", line 109, in write
  File "codecs.py", line 370, in write
  File "site-packages\colorama\ansitowin32.py", line 40, in write
  File "site-packages\colorama\ansitowin32.py", line 141, in write
  File "site-packages\colorama\ansitowin32.py", line 169, in write_and_convert
  File "site-packages\colorama\ansitowin32.py", line 174, in write_plain_text
IOError: [Errno 0] Error
Failed to execute script docker-compose

Somebody can tell me why? Thx!

Php automatically updated on the base image

The base image for the docker composer image is php:7-alpine3.8 which is automatically bumped to the lastest php minor version.
The issue is that a testing step in a CD process might automatically test application code on a newer php minor version.

A potential solution could be to align yourselves to the docker php tagging and publish builds from both 7-alpine3.8 and 7.2-alpine3.8 .

Thanks.

Using alpine as default

Is more secure to add suffix -alpine for docker optimized for this dist. My suggest is change tag to exists the normal version and the alpine version as PHP, Node and a bunch of official images.

can't mount composer home directory from host

I'm running docker on mac and I got this error when trying to mount the composer home directory from the host to the container

docker run --rm -it -v $COMPOSER_HOME:/composer composer bash
docker: Error response from daemon: invalid volume spec ":/composer": invalid volume specification: ':/composer'.
See 'docker run --help'.

docker version:

Client:
 Version:      17.03.0-ce
 API version:  1.26
 Go version:   go1.7.5
 Git commit:   60ccb22
 Built:        Thu Feb 23 10:40:59 2017
 OS/Arch:      darwin/amd64

Server:
 Version:      17.03.0-ce
 API version:  1.26 (minimum version 1.12)
 Go version:   go1.7.5
 Git commit:   3a232c8
 Built:        Tue Feb 28 07:52:04 2017
 OS/Arch:      linux/amd64
 Experimental: true

Libzip is missing

Hi,
I noticed a strange behaviour with the compose:1.8 image

I tried to build it on my computer and i got the error : "configure: error: Please reinstall the libzip distribution"
I don't understand why it works fine in the travis pipeline and not on my computer

Command run : docker build -t composer_test .
Output :

Sending build context to Docker daemon  5.632kB
Step 1/12 : FROM php:7-alpine3.8
 ---> 5d072bc6bdee
Step 2/12 : RUN apk --no-cache add git subversion openssh mercurial tini bash patch zip unzip
 ---> Using cache
 ---> c52cfea62cfc
Step 3/12 : RUN echo "memory_limit=-1" > "$PHP_INI_DIR/conf.d/memory-limit.ini"  && echo "date.timezone=${PHP_TIMEZONE:-UTC}" > "$PHP_INI_DIR/conf.d/date_timezone.ini"
 ---> Using cache
 ---> 90e7f121b58b
Step 4/12 : RUN apk add --no-cache --virtual .build-deps zlib-dev  && docker-php-ext-install zip  && runDeps="$(     scanelf --needed --nobanner --format '%n#p' --recursive /usr/local/lib/php/extensions     | tr ',' '\n'     | sort -u     | awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }'     )"  && apk add --virtual .composer-phpext-rundeps $runDeps  && apk del .build-deps
 ---> Running in 7029b8d156b0
fetch http://dl-cdn.alpinelinux.org/alpine/v3.8/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.8/community/x86_64/APKINDEX.tar.gz
(1/3) Installing pkgconf (1.5.3-r0)
(2/3) Installing zlib-dev (1.2.11-r1)
(3/3) Installing .build-deps (0)
Executing busybox-1.28.4-r1.trigger
OK: 96 MiB in 64 packages
fetch http://dl-cdn.alpinelinux.org/alpine/v3.8/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.8/community/x86_64/APKINDEX.tar.gz
(1/23) Installing m4 (1.4.18-r1)
(2/23) Installing perl (5.26.3-r0)
(3/23) Installing autoconf (2.69-r2)
(4/23) Installing dpkg-dev (1.18.24-r0)
(5/23) Installing dpkg (1.18.24-r0)
(6/23) Installing libmagic (5.32-r0)
(7/23) Installing file (5.32-r0)
(8/23) Installing libgcc (6.4.0-r9)
(9/23) Installing libstdc++ (6.4.0-r9)
(10/23) Installing binutils (2.30-r5)
(11/23) Installing gmp (6.1.2-r1)
(12/23) Installing isl (0.18-r0)
(13/23) Installing libgomp (6.4.0-r9)
(14/23) Installing libatomic (6.4.0-r9)
(15/23) Installing mpfr3 (3.1.5-r1)
(16/23) Installing mpc1 (1.0.3-r1)
(17/23) Installing gcc (6.4.0-r9)
(18/23) Installing musl-dev (1.1.19-r10)
(19/23) Installing libc-dev (0.7.1-r0)
(20/23) Installing g++ (6.4.0-r9)
(21/23) Installing make (4.2.1-r2)
(22/23) Installing re2c (1.0.2-r0)
(23/23) Installing .phpize-deps (0)
Executing busybox-1.28.4-r1.trigger
OK: 298 MiB in 87 packages
Configuring for:
PHP Api Version:         20180731
Zend Module Api No:      20180731
Zend Extension Api No:   320180731
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for a sed that does not truncate output... /bin/sed
checking for cc... cc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether cc accepts -g... yes
checking for cc option to accept ISO C89... none needed
checking how to run the C preprocessor... cc -E
checking for icc... no
checking for suncc... no
checking whether cc understands -c and -o together... yes
checking for system library directory... lib
checking if compiler supports -R... no
checking if compiler supports -Wl,-rpath,... yes
checking build system type... x86_64-pc-linux-musl
checking host system type... x86_64-pc-linux-musl
checking target system type... x86_64-pc-linux-musl
checking for PHP prefix... /usr/local
checking for PHP includes... -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib
checking for PHP extension directory... /usr/local/lib/php/extensions/no-debug-non-zts-20180731
checking for PHP installed headers prefix... /usr/local/include/php
checking if debug is enabled... no
checking if zts is enabled... no
checking for re2c... re2c
checking for re2c version... 1.0.2 (ok)
checking for gawk... no
checking for nawk... no
checking for awk... awk
checking if awk is broken... no
checking for zip archive read/writesupport... yes, shared
checking for the location of libz... no
checking pcre install prefix... no
checking libzip... yes
checking for the location of zlib... /usr
checking for pkg-config... /usr/bin/pkg-config
checking for libzip... not found
configure: error: Please reinstall the libzip distribution
The command '/bin/sh -c apk add --no-cache --virtual .build-deps zlib-dev  && docker-php-ext-install zip  && runDeps="$(     scanelf --needed --nobanner --format '%n#p' --recursive /usr/local/lib/php/extensions     | tr ',' '\n'     | sort -u     | awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }'     )"  && apk add --virtual .composer-phpext-rundeps $runDeps  && apk del .build-deps' returned a non-zero code: 1

The files are identicals to the one in the 1.8 folder of this repo

I managed to fix this by adding libzip-dev at the end of the line 8
image

docker-entrypoint.sh

Step 9/12 : COPY docker-entrypoint.sh /docker-entrypoint.sh
ERROR: Service 'composer' failed to build: COPY failed: stat /var/lib/docker/tmp/docker-builder573527686/docker-entrypoint.sh: no such file or directory

Missing keys

Hello!

Out of the box when I run

$ docker run -it composer diagnose 
#...
Checking pubkeys: FAIL
Missing pubkey for tags verification
Missing pubkey for dev verification
Run composer self-update --update-keys to set them up
#...

which is because we rm COMPOSER_HOME after install. Why? Thanks!

propagating keys in dind

I'm trying to use this container inside a gitlab-ci build with a private repository.

Repositories from github.com install fine, but for my private repo's I keep getting 'Host key verification failed." errors.

here is the current experiment I'm working on: https://gist.github.com/basz/87a0467541cc9f8dbd64a2f992a712df#file-gistfile1-txt-L11

Note that the git clone private-repo-url does work, telling me that key and known hosts are setup correctly on the 'docker:git' container.

It's a linux box, latest docker and gitlab (via docker)

edit: clue: Im now thinking it has something to do with the MOUNT_POINT environment var mentioned in here: https://docs.gitlab.com/ee/ci/docker/using_docker_build.html#use-docker-in-docker-executor The dind composer container might need to mount file/dirs from that...

Create /tmp/cache with write permissions

To share composer cache between multiple runs I use your example with an additional volume for the cache:

composer () {
    tty=
    tty -s && tty=--tty
    docker run \
        $tty \
        --interactive \
        --rm \
        --user $(id -u):$(id -g) \
        --volume /private/etc/passwd:/etc/passwd:ro \
        --volume /private/etc/group:/etc/group:ro \
        --volume $(pwd):/app \
        --volume cache:/tmp/cache \
        composer composer "$@"
} 

As the folder /tmp/cache doesn't exists, docker creates it with drwxr-xr-x so it's not writable by the user running the composer command.

To avoid this, I create an empty /tmp/cache folder

RUN mkdir -p -m 777 /tmp/cache

Private repository with Docker for Mac

Hi there!

I'm trying to install private repository using composer Docker image.
I'm running Docker for mac.

docker run --rm --interactive --tty \
    --volume $PWD:/app \
    --volume $SSH_AUTH_SOCK:/ssh-auth.sock \
    --volume /etc/passwd:/etc/passwd:ro \
    --volume /etc/group:/etc/group:ro \
    --user $(id -u):$(id -g) \
    --env SSH_AUTH_SOCK=/ssh-auth.sock \
    --workdir /app \
    composer:latest update

After the following error, I've added /private/tmp as shared path.

docker: Error response from daemon: Mounts denied:
The path /private/tmp/com.apple.launchd.FYsdWrYgET/Listeners
is not shared from OS X and is not known to Docker.
You can configure shared paths from Docker -> Preferences... -> File Sharing.
See https://docs.docker.com/docker-for-mac/osxfs/#namespaces for more info.

Now; I'm getting the following error :

Cannot create cache directory /tmp/cache/repo/https---packagist.org/, or directory is not writable. Proceeding without cache
Cannot create cache directory /tmp/cache/files/, or directory is not writable. Proceeding without cache
Loading composer repositories with package information

[RuntimeException]
/tmp/cache/vcs does not exist and could not be created.

I'm not mastering Docker at all.
Do you know why /tmpis ready only ?

Regards;

Composer insider container cannot download .tar files from private composer repository

Hi,

i use this image on Windows / WSL Ubuntu 18.04.

We have two private repositories. One from Oxid, and one for our extensions. Oxid deliver their packages as .tar files and we use .zip.

If we run composer install, the error at the end appears (only for .tar files) and the script stops.

Then i created another private repo, with one single .tar package and the same error stops the build.

All files except the .tar files are installed correctly in the cache file.

I testet it also on this environments and got no problems:

  • Docker for Ubuntu
  • Docker for Mac
  • Composer installed on Windows without container
  • Composer installed on WSL without container

If u want to test it, here is the privat file https://github.com/Sioweb/TarTest with repo and auth.json

- Installing seipp/tartest (1.0.0): Downloading https://tar-packages.seipp.com/oxid-tar/dist/seipp/tartest/seipp-tartest-1.0.0-a6c2e1.tar
Downloading (100%)Writing /tmp/cache/files/seipp/tartest/90c3bf30aae3359cc077a61ec83573fe438e06bb.tar into cache from /src/vendor/seipp/tartest/eb08f7499549a3565492fce3e941993e.tar

 Extracting archive

  [InvalidArgumentException]
  Invalid argument, /src/vendor/seipp/tartest/eb08f7499549a3565492fce3e941993e.tar cannot be found


Exception trace:
 () at phar:///usr/bin/composer/src/Composer/Downloader/TarDownloader.php:29
 PharData->extractTo() at phar:///usr/bin/composer/src/Composer/Downloader/TarDownloader.php:29
 Composer\Downloader\TarDownloader->extract() at phar:///usr/bin/composer/src/Composer/Downloader/ArchiveDownloader.php:47
 Composer\Downloader\ArchiveDownloader->download() at phar:///usr/bin/composer/src/Composer/Downloader/DownloadManager.php:216
 Composer\Downloader\DownloadManager->download() at phar:///usr/bin/composer/src/Composer/Installer/LibraryInstaller.php:197
 Composer\Installer\LibraryInstaller->installCode() at phar:///usr/bin/composer/src/Composer/Installer/LibraryInstaller.php:101
 Composer\Installer\LibraryInstaller->install() at phar:///usr/bin/composer/src/Composer/Installer/InstallationManager.php:173
 Composer\Installer\InstallationManager->install() at phar:///usr/bin/composer/src/Composer/Installer/InstallationManager.php:160
 Composer\Installer\InstallationManager->execute() at phar:///usr/bin/composer/src/Composer/Installer.php:594
 Composer\Installer->doInstall() at phar:///usr/bin/composer/src/Composer/Installer.php:228
 Composer\Installer->run() at phar:///usr/bin/composer/src/Composer/Command/InstallCommand.php:121
 Composer\Command\InstallCommand->execute() at phar:///usr/bin/composer/vendor/symfony/console/Command/Command.php:241
 Symfony\Component\Console\Command\Command->run() at phar:///usr/bin/composer/vendor/symfony/console/Application.php:843
 Symfony\Component\Console\Application->doRunCommand() at phar:///usr/bin/composer/vendor/symfony/console/Application.php:193
 Symfony\Component\Console\Application->doRun() at phar:///usr/bin/composer/src/Composer/Console/Application.php:254
 Composer\Console\Application->doRun() at phar:///usr/bin/composer/vendor/symfony/console/Application.php:117
 Symfony\Component\Console\Application->run() at phar:///usr/bin/composer/src/Composer/Console/Application.php:103
 Composer\Console\Application->run() at phar:///usr/bin/composer/bin/composer:56
 require() at /usr/bin/composer:24

install [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-dev] [--no-custom-installers] [--no-autoloader] [--no-scripts] [--no-progress] [--no-suggest] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--apcu-autoloader] [--ignore-platform-reqs] [--] [<packages>]...

Patching doesn't work

I've tested with composer installed locally and it works but using a image it doesn't work at all.

Composer:

docker run --rm -v $(pwd):/app:rw -v $HOME/.composer:/composer -v /etc/passwd:/etc/passwd:ro  -v /etc/group:/etc/group:ro --user $(id -u):$(id -g) composer ${@:2} --no-ansi --no-interaction --no-progress --optimize-autoloader --ignore-platform-reqs

composer.json:

{
    "require": {
        "brouwers/shortcodes": "1.*"
    },
    "config": {
        "preferred-install": "source",
        "process-timeout": 1800,
        "discard-changes" : true
    },
    "extra": {
        "patches": {
            "brouwers/shortcodes": {
                "Fixed bugs from Updates": "https://github.com/patrickbrouwers/Laravel-Shortcodes/compare/master...VeeeneX:master.patch"
            }
        }
    }
}

Gathering patches for dependencies. This might take a minute.
Found 1 patches for brouwers/shortcodes.
  - Installing brouwers/shortcodes (1.0.2)Executing command (CWD): git --version

    Cloning to cache at '/composer/cache/vcs/https---github.com-patrickbrouwers-Laravel-Shortcodes.git/'
Executing command (/composer/cache/vcs/https---github.com-patrickbrouwers-Laravel-Shortcodes.git/): git rev-parse --git-dir
Executing command (/composer/cache/vcs/https---github.com-patrickbrouwers-Laravel-Shortcodes.git/): git remote -v
Executing command (/composer/cache/vcs/https---github.com-patrickbrouwers-Laravel-Shortcodes.git/): git remote set-url origin 'https://github.com/patrickbrouwers/Laravel-Shortcodes.git' && git remote update --prune origin
 Cloning a35dc13a67e88f477d3429cc1bf0a2eee2297128 from cache
Executing command (CWD): git clone --no-checkout 'https://github.com/patrickbrouwers/Laravel-Shortcodes.git' '/app/vendor/brouwers/shortcodes' --dissociate --reference '/composer/cache/vcs/https---github.com-patrickbrouwers-Laravel-Shortcodes.git/' && cd '/app/vendor/brouwers/shortcodes' && git remote add composer 'https://github.com/patrickbrouwers/Laravel-Shortcodes.git' && git fetch composer
Executing command (/app/vendor/brouwers/shortcodes): git remote set-url --push origin '[email protected]:patrickbrouwers/Laravel-Shortcodes.git'
Executing command (/app/vendor/brouwers/shortcodes): git branch -r
Executing command (/app/vendor/brouwers/shortcodes): git checkout '1.0.2' --
Executing command (/app/vendor/brouwers/shortcodes): git reset --hard 'a35dc13a67e88f477d3429cc1bf0a2eee2297128' --
    REASON: Required by the root package: Install command rule (install brouwers/shortcodes 1.0.0|install brouwers/shortcodes 1.0.1|install brouwers/shortcodes 1.0.2)

  - Applying patches for brouwers/shortcodes
    https://github.com/patrickbrouwers/Laravel-Shortcodes/compare/master...VeeeneX:master.patch (Fixed bugs from Updates)
Downloading https://github.com/patrickbrouwers/Laravel-Shortcodes/compare/master...VeeeneX:master.patch
cd '/app/vendor/brouwers/shortcodes' && GIT_DIR=. git apply --check '-p1' '/tmp/589a3d0418aca.patch'
Executing command (CWD): cd '/app/vendor/brouwers/shortcodes' && GIT_DIR=. git apply --check '-p1' '/tmp/589a3d0418aca.patch'
error: patch failed: src/Brouwers/Shortcodes/Compilers/ShortcodeCompiler.php:1
error: src/Brouwers/Shortcodes/Compilers/ShortcodeCompiler.php: patch does not apply

Executing command (CWD): cd '/app/vendor/brouwers/shortcodes' && GIT_DIR=. git apply --check '-p0' '/tmp/589a3d0418aca.patch'
cd '/app/vendor/brouwers/shortcodes' && GIT_DIR=. git apply --check '-p0' '/tmp/589a3d0418aca.patch'
error: a/README.md: No such file or directory
error: a/composer.json: No such file or directory
error: a/src/Brouwers/Shortcodes/Compilers/Shortcode.php: No such file or directory
error: a/src/Brouwers/Shortcodes/Compilers/ShortcodeCompiler.php: No such file or directory
error: a/src/Brouwers/Shortcodes/Facades/Shortcode.php: No such file or directory
error: a/src/Brouwers/Shortcodes/Illuminate/View/Factory.php: No such file or directory
error: a/src/Brouwers/Shortcodes/Illuminate/View/View.php: No such file or directory
error: a/src/Brouwers/Shortcodes/Shortcode.php: No such file or directory
error: a/src/Brouwers/Shortcodes/ShortcodesServiceProvider.php: No such file or directory
error: a/src/config/config.php: No such file or directory

error: a/src/Brouwers/Shortcodes/Compilers/Shortcode.php: No such file or directory
error: a/src/Brouwers/Shortcodes/Compilers/ShortcodeCompiler.php: No such file or directory
error: a/src/Brouwers/Shortcodes/Facades/Shortcode.php: No such file or directory
error: a/src/Brouwers/Shortcodes/Illuminate/View/Factory.php: No such file or directory
error: a/src/Brouwers/Shortcodes/Illuminate/View/View.php: No such file or directory
error: a/src/Brouwers/Shortcodes/Shortcode.php: No such file or directory
error: a/src/Brouwers/Shortcodes/ShortcodesServiceProvider.php: No such file or directory

cd '/app/vendor/brouwers/shortcodes' && GIT_DIR=. git apply --check '-p2' '/tmp/589a3d0418aca.patch'
Executing command (CWD): cd '/app/vendor/brouwers/shortcodes' && GIT_DIR=. git apply --check '-p2' '/tmp/589a3d0418aca.patch'
fatal: git diff header lacks filename information when removing 2 leading pathname components (line 28)

patch '-p1' --no-backup-if-mismatch -d '/app/vendor/brouwers/shortcodes' < '/tmp/589a3d0418aca.patch'
Executing command (CWD): patch '-p1' --no-backup-if-mismatch -d '/app/vendor/brouwers/shortcodes' < '/tmp/589a3d0418aca.patch'
patch: unrecognized option: no-backup-if-mismatch

BusyBox v1.24.2 (2016-11-01 12:56:05 GMT) multi-call binary.

Usage: patch [OPTIONS] [ORIGFILE [PATCHFILE]]

        -p,--strip N            Strip N leading components from file names
        -i,--input DIFF         Read DIFF instead of stdin
        -R,--reverse            Reverse patch
        -N,--forward            Ignore already applied patches
        -E,--remove-empty-files Remove output files if they become empty

patch '-p0' --no-backup-if-mismatch -d '/app/vendor/brouwers/shortcodes' < '/tmp/589a3d0418aca.patch'
Executing command (CWD): patch '-p0' --no-backup-if-mismatch -d '/app/vendor/brouwers/shortcodes' < '/tmp/589a3d0418aca.patch'
patch: unrecognized option: no-backup-if-mismatch

BusyBox v1.24.2 (2016-11-01 12:56:05 GMT) multi-call binary.

Usage: patch [OPTIONS] [ORIGFILE [PATCHFILE]]

        -p,--strip N            Strip N leading components from file names
        -i,--input DIFF         Read DIFF instead of stdin
        -R,--reverse            Reverse patch
        -N,--forward            Ignore already applied patches
        -E,--remove-empty-files Remove output files if they become empty

patch '-p2' --no-backup-if-mismatch -d '/app/vendor/brouwers/shortcodes' < '/tmp/589a3d0418aca.patch'
Executing command (CWD): patch '-p2' --no-backup-if-mismatch -d '/app/vendor/brouwers/shortcodes' < '/tmp/589a3d0418aca.patch'
patch: unrecognized option: no-backup-if-mismatch

BusyBox v1.24.2 (2016-11-01 12:56:05 GMT) multi-call binary.

Usage: patch [OPTIONS] [ORIGFILE [PATCHFILE]]

        -p,--strip N            Strip N leading components from file names
        -i,--input DIFF         Read DIFF instead of stdin
        -R,--reverse            Reverse patch
        -N,--forward            Ignore already applied patches
        -E,--remove-empty-files Remove output files if they become empty

   Could not apply patch! Skipping. The error was: Cannot apply patch https://github.com/patrickbrouwers/Laravel-Shortcodes/compare/master...VeeeneX:master.patch

Reading /app/vendor/composer/installed.json
Reading ./composer.lock
Generating autoload files

Document global install changes since 1.4.2

Problem

Composer default global path changed in Docker image tag 1.4.3 without documentation, causing any dependencies on the default global path to break.

Verification through Config

Note that 1.4.2 uses /composer while newer images use /tmp.

$> docker run composer:1.4.2 composer config --list --global | grep dir
[vendor-dir] vendor (/app/vendor)
[bin-dir] {$vendor-dir}/bin (/app/vendor/bin)
[cache-dir] /composer/cache
[data-dir] /composer
[cache-files-dir] {$cache-dir}/files (/composer/cache/files)
[cache-repo-dir] {$cache-dir}/repo (/composer/cache/repo)
[cache-vcs-dir] {$cache-dir}/vcs (/composer/cache/vcs)
[archive-dir] .
$> docker run composer:1.4.3 composer config --list --global | grep dir
[vendor-dir] vendor (/app/vendor)
[bin-dir] {$vendor-dir}/bin (/app/vendor/bin)
[cache-dir] /tmp/cache
[data-dir] /tmp
[cache-files-dir] {$cache-dir}/files (/tmp/cache/files)
[cache-repo-dir] {$cache-dir}/repo (/tmp/cache/repo)
[cache-vcs-dir] {$cache-dir}/vcs (/tmp/cache/vcs)
[archive-dir] .
$> docker run composer:latest composer config --list --global | grep dir
[vendor-dir] vendor (/app/vendor)
[bin-dir] {$vendor-dir}/bin (/app/vendor/bin)
[cache-dir] /tmp/cache
[data-dir] /tmp
[cache-files-dir] {$cache-dir}/files (/tmp/cache/files)
[cache-repo-dir] {$cache-dir}/repo (/tmp/cache/repo)
[cache-vcs-dir] {$cache-dir}/vcs (/tmp/cache/vcs)
[archive-dir] .

Reproduction steps (1/2):

Look for the Changed current directory to <x> lines.

1.4.2:

$> docker run composer:1.4.2 composer global require --dev jakub-onderka/php-parallel-lint
Changed current directory to /composer
Using version ^0.9.2 for jakub-onderka/php-parallel-lint
./composer.json has been created
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 1 install, 0 updates, 0 removals
  - Installing jakub-onderka/php-parallel-lint (v0.9.2): Downloading (100%)         
jakub-onderka/php-parallel-lint suggests installing jakub-onderka/php-console-highlighter (Highlight syntax in code snippet)
Writing lock file
Generating autoload files

1.4.3:

$> docker run composer:1.4.3 composer global require --dev jakub-onderka/php-parallel-lint
Changed current directory to /tmp
Using version ^0.9.2 for jakub-onderka/php-parallel-lint
./composer.json has been created
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 1 install, 0 updates, 0 removals
  - Installing jakub-onderka/php-parallel-lint (v0.9.2): Downloading (100%)         
jakub-onderka/php-parallel-lint suggests installing jakub-onderka/php-console-highlighter (Highlight syntax in code snippet)
Writing lock file
Generating autoload files

Latest:

$> docker run composer composer global require --dev jakub-onderka/php-parallel-lint
Changed current directory to /tmp
Using version ^0.9.2 for jakub-onderka/php-parallel-lint
./composer.json has been created
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 1 install, 0 updates, 0 removals
  - Installing jakub-onderka/php-parallel-lint (v0.9.2): Downloading (100%)         
jakub-onderka/php-parallel-lint suggests installing jakub-onderka/php-console-highlighter (Highlight syntax in code snippet)
Writing lock file
Generating autoload files

Reproduction steps (2/2):

Folders affected by command above:

$> docker diff <container-id>
C /composer
C /composer/cache
A /composer/cache/<snipped>
A /composer/cache/repo
A /composer/cache/repo/<snipped>
A /composer/composer.json
A /composer/composer.lock
A /composer/vendor
A /composer/vendor/autoload.php
A /composer/vendor/bin
A /composer/vendor/bin/parallel-lint
A /composer/vendor/composer
A /composer/vendor/composer/<snipped>
A /composer/vendor/jakub-onderka
A /composer/vendor/jakub-onderka/php-parallel-lint
A /composer/vendor/jakub-onderka/php-parallel-lint/<snipped>
C /root
A /root/.subversion
A /root/.subversion/<snipped>
C /tmp

Folders affected by command in 1.4.3:

$> docker diff <container-id>
C /root
A /root/.subversion
A /root/.subversion/<snipped>
C /tmp
C /tmp/cache
A /tmp/cache/<snipped>
A /tmp/cache/repo
A /tmp/cache/repo/<snipped>
A /tmp/composer.json
A /tmp/composer.lock
A /tmp/vendor
A /tmp/vendor/autoload.php
A /tmp/vendor/bin
A /tmp/vendor/bin/parallel-lint
A /tmp/vendor/composer
A /tmp/vendor/composer/<snipped>
A /tmp/vendor/jakub-onderka
A /tmp/vendor/jakub-onderka/php-parallel-lint
A /tmp/vendor/jakub-onderka/php-parallel-lint/<snipped>

Folders affected by command in latest:

$> docker diff <container-id>
C /root
C /tmp
C /tmp/cache
Jasmines-iMac:cluster-creation-tool jhegman$ docker diff 792
C /root
A /root/.subversion
A /root/.subversion/<snipped>
C /tmp
C /tmp/cache
A /tmp/cache/<snipped>
A /tmp/cache/repo
A /tmp/cache/repo/<snipped>
A /tmp/composer.json
A /tmp/composer.lock
A /tmp/vendor
A /tmp/vendor/autoload.php
A /tmp/vendor/bin
A /tmp/vendor/bin/parallel-lint
A /tmp/vendor/composer
A /tmp/vendor/composer/<snipped>
A /tmp/vendor/jakub-onderka
A /tmp/vendor/jakub-onderka/php-parallel-lint
A /tmp/vendor/jakub-onderka/php-parallel-lint/<snipped>

Suggested Fix

Some documentation might be nice or the presence of this issue may help others debug if they have any problems.

composer create-project, the permissions of all directories is 777?

as i use this docker image, it works well with composer install and composer update, but i create a composer project, like:

docker run --rm -it -v $(pwd):/app -v $HOME/.composer-php:/tmp composer create-project laravel/laravel

i find that the permissions of all directories except vendor is 777. even command with

--volume /etc/passwd:/etc/passwd:ro \
--volume /etc/group:/etc/group:ro \
--user $(id -u):$(id -g) \

ps,

  • uname -a

Linux hahaha 3.16.0-4-amd64 #1 SMP Debian 3.16.36-1+deb8u2 (2016-10-19) x86_64 GNU/Linux

  • umask

0022

Possibility to add own ca certificates

To replace php+composer with docker and this image on local dev machines you write up a nice example:

composer () {
    tty=
    tty -s && tty=--tty
    docker run \
        $tty \
        --interactive \
        --rm \
        --user $(id -u):$(id -g) \
        --volume /etc/passwd:/etc/passwd:ro \
        --volume /etc/group:/etc/group:ro \
        --volume $(pwd):/app \
        composer "$@"
}

the only problem we have is that we can't add our own ca certificate on runtime.
A possible solution could be mounting a folder with the certs -v ~/Documents/ca-certificates:/usr/local/share/ca-certificates:ro and run update-ca-certificates > /dev/null 2>&1 from the docker-entrypoint.sh

Share ssh known_hosts with the container

Hello,

Is there any technique to share the ssh known_hosts file with the container ?

Like :

docker run --rm --interactive --tty \
    --volume $PWD:/app \
    --volume $SSH_AUTH_SOCK:/ssh-auth.sock \
    --volume /etc/passwd:/etc/passwd:ro \
    --volume /etc/group:/etc/group:ro \
    --volume $PWD/.ssh:/composer/.ssh \
    --user $(id -u):$(id -g) \
    --env SSH_AUTH_SOCK=/ssh-auth.sock \
    composer install

It looks like SSH keeps setting .ssh to the container user home even if home env variable is set.

Composer scripts are not executed

For example if I have custom script in composer.json:

"scripts": {
        "do-magic": [
            "@composer install",
            "rm -rf cache && mkdir -m 777 cache",
            "symlink something somewhere",
        ],
...

So running docker run --rm -t -v $(pwd):/app composer do-magic gives:

/docker-entrypoint.sh: line 60: exec: serve: not found

Write dependencies to a file

To use this image in a multistage build, it would be very helpful to write the dependencies to a file.
Than you could copy this file together with /usr/bin/composer over to the final build stage and install that packages (in case the final image is alpine based).

/docker-entrypoint.sh": permission denied

Hi!

I'm trying to run a composer: 1.3.1 image in my host, but when I try to run the "composer" command the shell returns the message bellow:

Exec: "/docker-entrypoint.sh": permission denied

I just inserted the chmod + x /docker-entrypoint.sh command in my Dockerfile, but the problem continues.

I have inserted the composer entry function in my ~ / .bashrc to load the composer installation of the image.

I'm using the docker-compose to clusterize my environment.

docker-compose.yml

version: '2'
services:
  php:
    build: data/php
    image: php:7.1
    ports:
      - "9000:9000"
    privileged: true
    volumes:
      - ./app:/usr/share/nginx/html
  composer:
    build: data/composer
    image: composer:1.3.1
  web:
    restart: always
    build: data/nginx
    image: nginx:1.10.2
    ports:
      - "8000:80"
    links:
      - php
    privileged: true
    volumes:
      - ./data/nginx/vhost.conf:/etc/nginx/conf.d/default.conf
      - ./data/nginx/nginx.conf:/etc/nginx/nginx.conf
      - ./app:/usr/share/nginx/html
      - ./data/log/nginx:/var/log/nginx
networks:
  default:
    external:
      name: myapp

Dockerfile

FROM php:7-alpine

RUN apk --no-cache add curl git subversion openssh openssl mercurial tini bash

RUN echo "memory_limit=-1" > "$PHP_INI_DIR/conf.d/memory-limit.ini" \
 && echo "date.timezone=${PHP_TIMEZONE:-UTC}" > "$PHP_INI_DIR/conf.d/date_timezone.ini"

ENV PATH "/composer/vendor/bin:$PATH"
ENV COMPOSER_ALLOW_SUPERUSER 1
ENV COMPOSER_HOME /composer
ENV COMPOSER_VERSION 1.3.1

RUN curl -s -f -L -o /tmp/installer.php https://raw.githubusercontent.com/composer/getcomposer.org/2091762d2ebef14c02301f3039c41d08468fb49e/web/installer \
 && php -r " \
    \$signature = '55d6ead61b29c7bdee5cccfb50076874187bd9f21f65d8991d46ec5cc90518f447387fb9f76ebae1fbbacf329e583e30'; \
    \$hash = hash('SHA384', file_get_contents('/tmp/installer.php')); \
    if (!hash_equals(\$signature, \$hash)) { \
        unlink('/tmp/installer.php'); \
        echo 'Integrity check failed, installer is either corrupt or worse.' . PHP_EOL; \
        exit(1); \
    }" \
 && php /tmp/installer.php --no-ansi --install-dir=/usr/bin --filename=composer --version=${COMPOSER_VERSION} \
 && rm /tmp/installer.php \
 && composer --ansi --version --no-interaction

COPY docker-entrypoint.sh /docker-entrypoint.sh

WORKDIR /app

ENTRYPOINT ["/docker-entrypoint.sh"]

RUN ["chmod", "+x", "/docker-entrypoint.sh"]

CMD ["composer"]

Private repository installed from - dirty - cache

Hi there,

I'm trying to install a private repository; but I'm encountering a problem with "cache" that I do not understand.

From two different Docker for mac hosts, mine & one of my teammate.

docker run --rm --interactive --tty \
     --volume $PWD:/app \
     --volume ~/.ssh:/root/.ssh:ro \
     composer:1.5.1 install

Installing dependencies (including require-dev) from lock file
Package operations: 1 install, 0 updates, 0 removals

  • Installing acme/event-store (dev-master eca84f8): Cloning eca84f8625 from cache

The above is common on both environment.
On my computer, the library was correctly installed but on the other the library was not installed... Only the .git has been created.

I've tried to clear-cache

docker run --rm --interactive --tty \
     --volume $PWD:/app \
     --volume ~/.ssh:/root/.ssh:ro \
     composer:1.5.1 clearcache

But; every time that I'm running composer install, this library, and only this one is installed from cache. But, what cache ?

Permissions not inheriting

I dont know if the issue I am encountering is related to this or not.

I have a Dockerfile in which I ensure a path I want composer to install packages to has the needed permissions (specifically, that it is writable). However, rather than inheriting the permissions (with +s set), everything composer installs is read-only. Adjusting the Dockerfile to then go back and manually make things writable extends build times significantly (I killed it off at 20mins last time.)

Any idea as to what might be preventing the permissions from inheriting? Ideas for a viable workaround?

netresearch/composer-patches-plugin fails to apply any patches

The composer plugin netresearch/composer-patches-plugin uses the command line
/usr/bin/patch -f -p1 --no-backup-if-mismatch -r - --dry-run
to check the patches.

But on the docker container only the busybox version of patch is available. This version does not support the '-f' parameter and fails
/ # /usr/bin/patch -f -p1 --no-backup-if-mismatch -r - --dry-run
/usr/bin/patch: unrecognized option: f
BusyBox v1.27.2 (2017-12-12 10:41:50 GMT) multi-call binary.

composer: The installation directory "/" is not writable

I have a problem with laravel, and it is that the route / is local host, in a menu that I have done does not direct me to where I said, but it tells me that the page does not exist, this is in linux mint, because in windows , the same code, exactly the same, if it does its normal function, even when I press the 'home' option it sends me to the local host and not to the 'home' menu, I tried to uninstall and reinstall, and when I'm installing the composer He gave me the message: The installation directory "/" is not writable

I need help

entrypoint and custom scripts

I now need to do specify the command twice to run custom composer scripts where this was working before.

Note the double composer composer, this is macOS

 docker run   $tty --rm --interactive $(pinata-ssh-mount)   \
--volume "$PWD":/app:rw   \
--volume "$HOME"/.composer:/tmp/.composer:rw   \
--volume "$HOME"/.ssh/config:/etc/ssh/ssh_config:ro  \
 --volume "$HOME"/.ssh/known_hosts:/etc/ssh/ssh_known_hosts:ro   \
--env COMPOSER_HOME=/tmp/.composer  \
composer cs

/docker-entrypoint.sh: exec: line 60: cs: not found
 docker run   $tty --rm --interactive $(pinata-ssh-mount)   \
--volume "$PWD":/app:rw   \
--volume "$HOME"/.composer:/tmp/.composer:rw   \
--volume "$HOME"/.ssh/config:/etc/ssh/ssh_config:ro  \
 --volume "$HOME"/.ssh/known_hosts:/etc/ssh/ssh_known_hosts:ro   \
--env COMPOSER_HOME=/tmp/.composer  \
composer composer cs

 [Symfony\Component\Console\Exception\CommandNotFoundException]  
  Command "cs" is not defined.         

Known command still work;

 docker run   $tty --rm --interactive $(pinata-ssh-mount)   \
--volume "$PWD":/app:rw   \
--volume "$HOME"/.composer:/tmp/.composer:rw   \
--volume "$HOME"/.ssh/config:/etc/ssh/ssh_config:ro  \
 --volume "$HOME"/.ssh/known_hosts:/etc/ssh/ssh_known_hosts:ro   \
--env COMPOSER_HOME=/tmp/.composer  \
composer validate

./composer.json is valid for simple usage with composer but has
strict errors that make it unable to be published as a package:
...

Use Composer's Docker image vs install Composer manually to PHP-FPM

Could you explain a bit why Composer has its own Docker image? Is it best practice to use official Composer's Docker image instead of manually installing Composer to my custom php:fpm image? Any benefit? In this case, I need to share my PHP-FPM environment with the composer image in order to use Composer as a standalone container. is it a good idea to duplicate my php.ini config for PHP-FPM with Composer? I'd love to hear any thoughts about it.

I also think it would be nice to have the answer to these questions in the readme file of Composer's Docker image.

PHP Version

I have been trying to use composer to install a application but I have dependencies that require php ^5.5.9|>=7.0.8.

Is there a way to upgrade the version of php? Or a different possible solution that i'm not aware of?

prepending PATH not guaranteed to work as expected

If a user decides to use a different directory as their home directory for Composer, then the current way of prefixing the PATH is basically useless. On top of that, by default this serves no purpose.

Requires ext-intl * -> the requested PHP extension intl is missing from your system

docker run --rm --volume $PWD:/app composer install --no-dev -o -n

Loading composer repositories with package information
Installing dependencies from lock file
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Installation request for xxxx/user 5.1.0 -> satisfiable by xxxx/user[5.1.0].
    - xxxx/user 5.1.0 requires ext-intl * -> the requested PHP extension intl is missing from your system.
  Problem 2
    - Installation request for sebastian/money v1.6.2 -> satisfiable by sebastian/money[v1.6.2].
    - sebastian/money v1.6.2 requires ext-intl * -> the requested PHP extension intl is missing from your system.
  Problem 3
    - sebastian/money v1.6.2 requires ext-intl * -> the requested PHP extension intl is missing from your system.
    - xxxx/money 0.3.0 requires sebastian/money ~1.5 -> satisfiable by sebastian/money[v1.6.2].
    - Installation request for xxxx/money 0.3.0 -> satisfiable by xxxx/money[0.3.0].

  To enable extensions, verify that they are enabled in your .ini files:
    - 
    - /usr/local/etc/php/conf.d/date_timezone.ini
    - /usr/local/etc/php/conf.d/docker-php-ext-zip.ini
    - /usr/local/etc/php/conf.d/memory-limit.ini
  You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode.

Add php5.6 as supported image

I would love to use this image, but we are still stuck on php5.6.
Could you add support for that through the php:5.6-alpine docker image?

[Proposal] Recommend using multi-stage build to use composer

See https://medium.com/@othillo/adding-composer-to-php-docker-images-using-multi-stage-builds-2a10967ae6c1 for the explanation about this feature.

A common issue with people using this image is that they run composer inside the container generated by this image, which may have different platform packages than their actual runtime. Here are some issues they may face:

  • the install fails if they are missing extensions in the composer image (while they are available in their runtime image, which is where the code will be used)
  • the install does not fail for missing extensions in the runtime image (for extensions being part of the container image), leading to broken runtime
  • the update selects packages for the wrong platform, leading people to stop relying on platform requirements in composer updates (and then asking package maintainers to treat a bump of the min PHP version as a BC break requiring a major version)

How to change vendor owner ?

I using docker-compose to manage containers. When I run composer install in the vendor directory, all subfolders are created with the root owner. I can't delete them after that. How do I create folders under another user ?
`
version: '3'

services:

composer:

    container_name: composer

    build:

        context: ./docker/etc/composer

        dockerfile: Dockerfile

    volumes:

      - "./:/app"

    command: composer install

`

Volume mounting SSH keys not working

I am attempting to pass in my local SSH private key. To do so I am volume mounting ~/.ssh/id_rsa into /root/.ssh/id_rsa. This is the command I am using:

docker run -v `pwd`:/app -v ~/.ssh:/root/.ssh composer install

When it gets down to my private repository as described by the composer.lock file, I get the following error (private information substituted with filler text):

Installing myorg/mypackage (1.0.0): Downloading (failed)    Failed to download myorg/mypackage from dist: The "https://api.gi
thub.com/repos/myorg/mypackage/zipball/<random_hash>" file could not be downloaded (HTTP/1.1 404 Not Found)

Now trying to download from source
  - Installing myorg/mypackage (1.0.0): Cloning <random_hash>

  [RuntimeException]

  Failed to execute git clone --no-checkout '[email protected]:myorg/mypackage.git' '/app/vendor/myorg/mypackage' && cd '/app/vendor/
myorg/mypackage' && git remote add composer '[email protected]:myorg/mypackage.git' && git fetch composer

Bitbucket Private Repository

I'm trying to use a private repository hosted on Bitbucket and I can't get it to work using either auth.json or COMPOSER_AUTH environment variable. Either way I get a permission denied (publickey) error.

I'm following the directions here: https://getcomposer.org/doc/05-repositories.md#bitbucket-driver-configuration

I can confirm that I have a env variable COMPOSER_AUTH in my container and it looks like:

COMPOSER_AUTH={
  "bitbucket-oauth": {
    "bitbucket.org": {
      "consumer-key": "my-key",
      "consumer-secret": "my-secret"
    }
  }
}

Any thoughts on what I could try next? The only luck I've had is when I link my private key as a volume (but I don't want to use that method). Is there something I am missing? Some way to let docker composer know not to use a key but instead use OAuth?

composer installs dev-master instead of the correct version

hi there,

today i noticed something very strange, and i don´t know if it's a problem on my side or a bug or whatever...
i tried to install this package:

(Composer version 1.4.2, latest docker image)

composer --ignore-platform-reqs require "laravie/parser=~1.0"

and this ends up with the following dependencies:

illuminate/contracts                dev-master 1cc9ce9        The Illuminate Contracts package.
illuminate/support                  dev-master fcaaaeb        The Illuminate Support package.

when i use the same docker version inside my php container (php 5.6.30) i get these dependencies installed:

illuminate/contracts                5.4.x-dev 68569e8         The Illuminate Contracts package.
illuminate/support                  5.4.x-dev 6aa05cb         The Illuminate Support package.

and this is correct, so why does the docker version installes the dev-master versions instead of the correct versions ???

thanks for any help !

[BC] COMPOSER_HOME=/tmp breaks BC

I've wrapped this image and am using it as a base for my CI/QA type image.

What started happening is our build took way longer than before, I didn't pay much attention but it was pointed out to me it downloads all packages every time, clearly a cache issue.

It came down to the image introducing (or changing?) COMPOSER_HOME env variable which now points to /tmp, but used to point to /composer. Seeing it's probably irrelevant for the image itself where it points to, the path could have stayed the same here.

I've since fixed it, but it would make sense to default to previously hardcoded values if not significant enough, like this one?

Docker for windows, private repo, ssh-agent does not work

I'm using docker for windows. My composer.json refers to a private repo on bitbucket (type "git").
I'm using Git Bash (from git for windows).
The ssh keys are added to the ssh-agent started via git bash.

I'm calling composer with

docker run --rm --interactive --tty \
    --mount type=bind,src="$PWD",target=/app \
    --mount type=bind,src="$SSH_AUTH_SOCK",target=/ssh-auth.sock \
    --env SSH_AUTH_SOCK=/ssh-auth.sock \
    composer install

But no matter what I try, I keep getting:

[RuntimeException]                                                                                                                                                                                                                 
  Failed to execute git clone --no-checkout '[email protected]:....git' '/app/....' && cd '/app/...' && git remote add composer '[email protected]:.....git' && git fetch composer                                                                                                                                                                                                                  
                                                                                                                                                                                                                                     
  Cloning into '/app/...'...                                                                                                                                                                                     
  Warning: Permanently added the RSA host key for IP address '104.192.143.3' to the list of known hosts.                                                                                                                             
  Permission denied (publickey).                                                                                                                                                                                                     
  fatal: Could not read from remote repository.                                                                                                                                                                                      

Do you have any idea what might be wrong?

Pin to upstream version

PHP 7.2 is the newest php:7-alpine, which doesn't support xdebug, so everything went boom. Maybe be a bit less wide-ranging than just a major number, and pin to a minor as well?

Use PHP base image with new Alpine

Hi all,

Current base image is php:7-alpine.
Is it possible to use base image php:7-alpine3.7 instead?

Alpine 3.7 has fresh packages/libs which might be useful for people who use dockerized composer as base image in Dockerfile.

Thanks

PS. Pull request: #43

composer global require - executable file not found in $PATH

Hey, thanks for putting all the effort into an official image! Well done!

Working scenario in composer/composer

I'm migrating from composer/composer:1.1, where the following Dockerfile worked:

Dockerfile

FROM composer/composer:1.1

RUN composer global require 'phpmetrics/phpmetrics'

CMD [""]
ENTRYPOINT ["phpmetrics"]

Execution

> docker build --tag phpmetrics . 
...
> docker run --rm phpmetrics --version
PhpMetrics, by Jean-François Lépine (https://twitter.com/Halleck45) version v1.10.0

Not working here

Dockerfile

FROM composer:1.2.2

RUN composer global require 'phpmetrics/phpmetrics'

CMD [""]
ENTRYPOINT ["phpmetrics"]

Execution

> docker build --tag phpmetrics . 
...
> docker run --rm phpmetrics --version
docker: Error response from daemon: invalid header field value "oci runtime error: container_linux.go:247: starting container process caused \"exec: \\\"phpmetrics\\\": executable file not found in $PATH\"\n".

Solution, probably

I think it might be made to work with these lines here https://github.com/RobLoach/docker-composer/blob/ac801a0949fa23da7284174d4ab08d76a54148d0/base/Dockerfile#L45-L46

ENV PATH /composer/vendor/bin:$PATH

Update: Apparently, this line is already included in this image, however it appears to not have the desired effect.

Conclusion

I would expect this to work, and I hope you can include it here.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.