Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

composer home directory not writable when running as custom user #13

Closed
alcohol opened this issue May 1, 2017 · 6 comments
Closed

composer home directory not writable when running as custom user #13

alcohol opened this issue May 1, 2017 · 6 comments

Comments

@alcohol
Copy link
Member

alcohol commented May 1, 2017

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.

@meteorlxy
Copy link

Maybe we can use something like --volume ~/.composer/cache:/composer/cache:rw to enable the cache?

@alcohol
Copy link
Member Author

alcohol commented Jul 10, 2017

I defaulted the COMPOSER_HOME to /tmp in the image template. The next release should see this change. So in future release (> 1.4.2) you can do --volume ~/.composer/cache:/tmp/cache:rw.

I chose this solution because /tmp generally does not have any permission issues.

@meteorlxy
Copy link

I see. BTW, is there a way to change the default packagist source globally? I have to make a new image adding RUN composer config -g repo.packagist composer https://custom.packagist.source

@alcohol
Copy link
Member Author

alcohol commented Jul 10, 2017

Your solution is the only way to make it an explicit default in the image/container itself.

Alternatively, you can mount your Composer home directory (~/.composer usually) onto /tmp inside the image (assuming the composer configuration on your host has this desired default changed).

@bicpi
Copy link

bicpi commented Aug 16, 2017

This change is not yet reflected in the docs.

@alcohol
Copy link
Member Author

alcohol commented Aug 16, 2017

It should be soon. docker-library/docs#981

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants