robloach / docker-composer Goto Github PK
View Code? Open in Web Editor NEW:ok_woman: Docker container to install and run Composer.
Home Page: https://hub.docker.com/r/library/composer/
License: Other
:ok_woman: Docker container to install and run Composer.
Home Page: https://hub.docker.com/r/library/composer/
License: Other
The master image is version 1.0-dev (66acee7feb51d4b30e8983c703bf07ce1d06883e) 2015-09-12 22:04:37
.
The latest composer version is 1.0-dev (a54f84f05f915c6d42bed94de0cdcb4406a4707b) 2015-10-13 13:09:04
.
Among other changes it's missing out on the new --classmap-authoritative
option for the install command.
It'd be great to automate updating of the master image when the composer project is updated.
Hello. I'd like propose idea about persistent mode whenever something like gulp will watch that composer config has changed, and composer will re-update vendor components. It's useful for development stage.
Hello,
I tried to create a Symfony project using this docker container.
It fails while running the post-install-cmd scripts because date.timezone
is not set.
This is caused by the fact that php ini dir is hard-coded and does not correspond to ini directory defines in php:5.6-cli docker container.
There are allot of down stream providers that depend on this repository AKA PHPUnit:
Please let us know if there are intentions to fix this issue or we will have to migrate to another image.
thanks :-)
Now that we have update.sh
, it will make maintaining the PHP5 easier. Let's bring php5
into the master
branch.
Right now docker-compose has contained version, that could be ran with sh script. Here is sh script https://github.com/docker/compose/blob/master/script/run/run.sh
I see that such script already there in readme, but would be great to have it in repo.
I think there should be similar sh script for composer container, it will be very useful!
This is with pulling the php7 alpine image.
Make it match how the PHP docker docs look
Hello,
If I use composer without changing any settings my vendor will get root:root 755 permissions.
If I use my own UID for user and/or group it will fail on writing into the cache.
Am I doing something wrong or is this the expected behaviour?
For the install instruction, I run below command to create a new project.
$ cat /usr/local/bin/composer
#!/bin/sh
export PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin
echo "Current working directory: '"$(pwd)"'"
docker run --rm -v $(pwd):/app -v ~/.ssh:/root/.ssh composer/composer $@
$ composer
Current working directory: '/Users/bill/composer'
______
/ ____/___ ____ ___ ____ ____ ________ _____
/ / / __ \/ __ `__ \/ __ \/ __ \/ ___/ _ \/ ___/
/ /___/ /_/ / / / / / / /_/ / /_/ (__ ) __/ /
\____/\____/_/ /_/ /_/ .___/\____/____/\___/_/
/_/
Composer version 1.0.0 2016-04-05 13:27:25
If I run composer global require "laravel/installer"
, the command runs well, but there is no new folders generated.
So I have to manually created a composer.json
file, and this time I got all vendor folders.
$ cat composer.json
{
"require": {
"laravel/installer": ">=1.3.3"
}
}
$ composer install
I need create a new project, I run below command:
$ vendor/bin/laravel new blog
...
phpunit/phpunit suggests installing phpunit/php-invoker (~1.1)
Generating autoload files
Application ready! Build something amazing.
I found the APP Key
is not automatically generated, if I run the command manually:
$ php artisan key:generate
Warning: require(/Users/bill/composer/blog/bootstrap/../vendor/autoload.php): failed to open stream: No such file or directory in /Users/bill/composer/blog/bootstrap/autoload.php on line 17
Fatal error: require(): Failed opening required '/Users/bill/composer/blog/bootstrap/../vendor/autoload.php' (include_path='.:') in /Users/bill/composer/blog/bootstrap/autoload.php on line 17
then I run with composer create-project --prefer-dist laravel/laravel blog
, this time everything works fine.
$ composer create-project --prefer-dist laravel/laravel blog
...
phpunit/phpunit suggests installing phpunit/php-invoker (~1.1)
Writing lock file
Generating autoload files
> Illuminate\Foundation\ComposerScripts::postUpdate
> php artisan optimize
Generating optimized class loader
@Markcial asks...
what about missing modules like bcmath? why gd is in the container but there is no mcrypt for example?
Those would be great modules to add.
Should we do this? Or should we inform users to use --user
in docker use.
Most docker containers have the ability support entering into bash by adding an entrypoint script.
Something like this will do:
entrypoint.sh
if [ "$1" == composer ]; then
exec "composer --ansi ${@:2}"
else
exec "$@"
fi
And in your Dockerfile
ADD entrypoint.sh /entrypoint.sh
CMD ["composer"]
ENTRYPOINT ["/entrypoint.sh"]
Why does the base composer images install so many php extensions and system deps? Are these really all required?
If they are, please let me know.
If they're there to cover general use-cases, I'll submit a PR to provide this in a more sophistiated manner.
From https://hub.docker.com/r/composer/composer/
akosgluebe said (3 months ago)
Hello,It is shown how to make an alias: "Now the composer command is available native on host". Great.
How could I make this alias/this command available in a running container? Lets say I start up, for example, the latest jenkins container (or whatever other container), how could I use this composer inside that container? (I would like to avoid docker in docker)
Thanks!
i have same his question, can we run this in a other container ?
i see this problem a long time ago but can't think any simple resolution.
Anyone may suggest for me, thx :)
Would be nice to have this as one of the "official" repositories available in Docker....
Hi, I'm new to docker-compose and wanted to use this docker container in my project. I'm a little unsure what that would look like. Here's my best guess, can you advise?
php:
build: ./php/
links:
- composer
# skipping lines . . .
composer:
build: ./composer/
# etc...
And then inside of ./composer/
a Dockerfile like so
FROM composer/composer
# Use local composer.json file
COPY ./composer.json /var/www/html/composer.json
WORKDIR /var/www/html
RUN composer install
Thanks for the great project(s)!
I noticed most (not sure if all) of the official docker images are using a simplified folder structure. They only take the major.minor version and map that to a folder name. When the major.minor.patch is updated that gets reflected in the dockerfile but if the major.minor didn't change the folder name wouldn't.
Is this something we wanted to take a look at? Here are some examples showing all the tags still existing but folder structure a bit simplified in the repo:
Solr
https://github.com/docker-solr/docker-solr
https://hub.docker.com/r/library/solr/tags/
Postgres
https://github.com/docker-library/postgres
https://hub.docker.com/r/library/postgres/tags/
Node
https://github.com/nodejs/docker-node
https://hub.docker.com/r/library/postgres/tags/
I for sure might be missing something but thought would start discussion :)
The alpha
and beta
s are deprecated. Remove them.
patch
and tar
would be good packages to have.
Composer installer was updated, so using repository outdated code I had an error message : "Invalid installer". I checked base/Dockerfile validation use SHA hardcoded.
Is not a good idea using installer.sig for it ?
Something like:
RUN export COMPOSER_INSTALLER_SHA384=$(curl https://composer.github.io/installer.sig) \
&& php -r "readfile('https://getcomposer.org/installer');" > /tmp/composer-setup.php \
&& php -r "if (hash('SHA384', file_get_contents('/tmp/composer-setup.php')) !== '${COMPOSER_INSTALLER_SHA384}') { unlink('/tmp/composer-setup.php'); echo 'Invalid installer' . PHP_EOL; exit(1); }"
It currently is 1GB big, which is a little too much.
Why are they installed in the first place? The size of the image is 585 MB, that's very huge!
@eugene-dounar , what's your Docker Hub username? I'll add you as a maintainer on
https://registry.hub.docker.com/u/composer/composer/
RUN composer --version
PR #7 broke all commands but install
and update
. The cause is --ignore-platform-reqs
hard-coded option that is only supported by those commands.
Hi,
I would like to share my host composer cache with the container cache. How can I proceed?
I have already tried the following :
docker run -ti -v $PWD:/data -w /data composer/composer install -w ~/.composer:/root/.composer --ignore-platform-reqs
It should point to the latest alpha or master. TBD โ which one?
I use the standard composer/composer build. It seems that the extension is installed and loaded. But in the phpinfo() the extension is not loaded / listed.
So if I install laravel via my composer container I get a error that the mcrypt extension is missing.
Output php -m:
[PHP Modules]
Core
ctype
curl
date
dom
ereg
fileinfo
filter
hash
iconv
json
libxml
mysqlnd
openssl
pcre
PDO
pdo_sqlite
Phar
posix
readline
recode
Reflection
session
SimpleXML
SPL
sqlite3
standard
tokenizer
xml
xmlreader
xmlwriter
zip
zlib
[Zend Modules]
Dockerfile:
# Composer Docker Container
FROM php:5.6-cli
MAINTAINER Rob Loach <[email protected]>
ENV DEBIAN_FRONTEND noninteractive
# Dependencies
RUN echo "deb http://packages.dotdeb.org wheezy all" >> /etc/apt/sources.list
RUN echo "deb-src http://packages.dotdeb.org wheezy all" >> /etc/apt/sources.list
RUN curl http://www.dotdeb.org/dotdeb.gpg | apt-key add -
RUN apt-get update
RUN apt-get upgrade -y
RUN apt-get install -y zlib1g zlib1g-dev php5-common git mercurial subversion
RUN apt-get install -y php5-curl php5-gd php5-json php5-mcrypt php5-mysql php5-pgsql php5-readline php5-sqlite sqlite3 mysql-client php5-mysql mcrypt php-pear
# Enable any modules
RUN php5enmod curl json mysql mysqli pdo_mysql pdo_sqlite readline gd mcrypt pdo sqlite3
RUN pecl install zip
RUN echo "extension=zip.so" > /usr/local/etc/php/conf.d/extension-zip.ini
# Set memory limit
RUN echo "memory_limit=1024M" > /usr/local/etc/php/conf.d/memory-limit.ini
# Set environmental variables
ENV COMPOSER_HOME /root/composer
# Install Composer
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer --version=1.0.0-alpha8
# Display version information
RUN php --version
RUN composer --version
# Set up the application directory.
VOLUME ["/app"]
WORKDIR /app
# Set up the command arguments
CMD ["-"]
ENTRYPOINT ["composer", "--ansi"]
If I want to fetch a repository from github it fails. I think because credentials need to be passed to github.
{
"repositories": [
{
"type": "vcs",
"url": "git://github.com/boedy/phinx.git"
}
],
"require": {
"robmorgan/phinx": "dev-SQLite-bugfix"
}
}
I get the following error. Is there a way that the credentials could be passed?
Failed to clone the [email protected]:boedy/phinx.git repository, try running in interactive mode so that you can enter your GitHub credentials
[RuntimeException]
Failed to execute git clone --mirror '[email protected]:boedy/phinx.git' '/root/composer/cache/vcs/git-github.com-boedy-phinx.git/'
I get;
[UnexpectedValueException]
Could not parse version constraint ^1.0.2: Invalid version string "^1.0.2"
When running;
docker run -it --rm -v `pwd`:/app/ composer/composer:latest install
Could you re-trigger an automated build to get latest composer.phar into the image?
I am getting the following error, when I try to install a needed php extension.
WARNING: The repository tag for world dependency 'php7-pear@testing' does not exist
How can I add php extension intl to composer? I got this error requires ext-intl * -> the requested PHP extension intl is missing from your system.
Hey,
Noticed that running this container the composer process crashes out with only a couple of dependences (for example: Silex, phpUnit). This looks like it is linked to the same issue here: composer/composer#2704
Have got a fix example here: https://registry.hub.docker.com/u/tomwilderspin/composer/dockerfile/
by increasing the max memory limit in the ini file. Pull request to follow with the amend ๐
When I run
docker run --rm -v $(pwd):/app -v ~/.ssh:/root/.ssh composer/composer:alpine outdated
I get
[RuntimeException]
Failed to execute git clone --mirror '[email protected]:repo/name.git' '/composer/cache/vcs/git-bitbucket.org-repo-name.git/'
Cloning into bare repository '/composer/cache/vcs/git-bitbucket.org-repo-name.git'...
error: cannot run ssh: No such file or directory
fatal: unable to fork
The "latest" version is working fine.
When trying to use composer/composer:php5-alpine
in Gitlab CI, there is some odd error occuring:
The .gitlab-ci.yml
looks like this:
image: composer/composer:php5-alpine
stages:
- build
- test
- deploy
# Jobs
satis-build:
stage: build
script:
- ls
and creates a build output like this:
gitlab-ci-multi-runner 1.3.2 (0323456)
Using Docker executor with image composer/composer:php5-alpine ...
Pulling docker image composer/composer:php5-alpine ...
Running on runner-420782f7-project-64-concurrent-0 via build-runner-githost...
Fetching changes...
HEAD is now at 8d19828 More tests
From https://gitlab.undpaul.de/undpaul/packages
8d19828..9141eee master -> origin/master
Checking out 9141eee5 as master...
[Symfony\Component\Console\Exception\RuntimeException]
The "-c" option does not exist.
show [--all] [-i|--installed] [-p|--platform] [-a|--available] [-s|--self] [-N|--name-only] [-P|--path] [-t|--tree] [-l|--latest] [-o|--outdated] [-D|--direct] [--] [<package>] [<version>]
[Symfony\Component\Console\Exception\RuntimeException]
The "-c" option does not exist.
show [--all] [-i|--installed] [-p|--platform] [-a|--available] [-s|--self] [-N|--name-only] [-P|--path] [-t|--tree] [-l|--latest] [-o|--outdated] [-D|--direct] [--] [<package>] [<version>]
ERROR: Build failed: exit code 1
Allow downloading of different versions through Composer.
ERROR: unsatisfiable constraints:
php-pear (missing):
required by: world[php-pear]
I've been experimenting with this layer to see if it would be usable in place of a local composer install, as well as as a container within a docker-compose specification. One thing I'm running into is that execution of it appears to imply the --no-interaction
flag.
As an example, try the following:
$ docker run --rm -u $UID -v `pwd`:/app composer/composer create-project zendframework/skeleton-application zf3-via-docker
This project includes a couple of composer plugins, zend-component-installer and zend-skeleton-installer, which each normally have prompts to allow the developer to provide information (in the former case, to potentially add application configuration; in the latter, to modify dependencies). In both cases, as well, running without interaction triggers default actions (usually: do nothing), or, detects that work has already been done and do nothing.
When run with this docker layer, however, I can see the plugins being triggered, but am never given the expected prompts.
I've run composer within layers previously (we include it with the default Dockerfile
in the ZF skeleton application, for instance), and it runs normally, prompting as expected.
I've combed through this repo, and cannot see that the flag is being passed; is there perhaps some other configuration file I'm missing?
tl;dr: I'd like to run composer with interaction.
Php 7 is going to be released, why not to add a branch with php7 under the hood?
Move the GitHub repository move to http://github.com/composer/docker or http://github.com/composer/dockerfile
I am trying the composer image like this:
version: '2'
services:
php:
build: .
volumes:
- .:/var/www/html
web:
image: nginx
ports:
- "80:80"
volumes:
- .:/var/www/html
- ./server.conf:/etc/nginx/conf.d/default.conf
links:
- php
composer:
image: 'composer/composer'
volumes:
- .:/var/www/html
working_dir: /var/www/html
command: update
When running docker-compose run composer
, I'll get the following message:
Your requirements could not be resolved to an installable set of packages.
Next a list follows of unresolved requirements because some extensions of the framework are not installed. However, I installed them on my own build, which should be enough.
Any suggestions what I'm doing wrong?
In my opinion the composer image should only install composer and run the commands. Requirements of the machine are done in the php build....
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Warning: The lock file is not up to date with the latest changes in composer.json. You may be getting outdated dependencies. Run update to update them.
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Installation request for mockery/mockery 0.9.4 -> satisfiable by mockery/mockery[0.9.4].
- mockery/mockery 0.9.4 requires hamcrest/hamcrest-php ~1.1 -> no matching package found.
Potential causes:
Read https://getcomposer.org/doc/articles/troubleshooting.md for further common problems.
This for PHPUnit which in turn (here at least) needs PHP/Invoker which requires pcntl.
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.
Problem 1
- phpunit/php-invoker 1.1.4 requires ext-pcntl * -> the requested PHP extension pcntl is missing from your system.
- phpunit/php-invoker 1.1.3 requires ext-pcntl * -> the requested PHP extension pcntl is missing from your system.
- phpunit/php-invoker 1.1.2 requires ext-pcntl * -> the requested PHP extension pcntl is missing from your system.
- phpunit/php-invoker 1.1.1 requires ext-pcntl * -> the requested PHP extension pcntl is missing from your system.
- Installation request for phpunit/php-invoker * -> satisfiable by phpunit/php-invoker[1.1.1, 1.1.2, 1.1.3, 1.1.4].
I was reading over: https://github.com/docker-library/official-images
and just wondering if over the next few weeks / months we were going to try to make this the official repo for composer? If the upstream folks are cool with that?
I think we just need to add a customized update.sh + generate-stackbrew-library.sh script which I am happy to start taking a look at, but wanted to check in first. ^_^
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.