G
G
gog692016-09-08 12:45:13
Docker
gog69, 2016-09-08 12:45:13

How to run "composer require" inside docker by adding ssh-key?

in the php container, I first run
docker-compose exec php php composer.phar install
to install symfony and everything that is written in composer.json and all dependencies are loaded normally
, then I have a private repository in composer.json, but when I do
docker-compose exec php php composer.phar require my/private
then there is no ssh key and ssh too and can't load it
how to do it?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
T
Tyranron, 2016-09-08
@Tyranron

Try mounting the key (and ssh.config, if desired) into the container.
If the command php composer.phar installis executed on behalf of rootinside the container, then the following lines should be in `docker-compose.yml`:

version: '2'
services:
  php:
    ...
    volumes:
      ...
      - /path/to/my.key:/root/.ssh/repo.key:ro
      ...
    ...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question