Category: Uncategorized

Docker, Composer and SSH

Docker, Composer and SSH

I have been working with LAMP in Docker containers.  One of my frustrations has been ssh inside the Docker containers.

While there are many good solutions, none appealed to me.

My solutions was to modify the official Composer Docker Image to take a ssh key from an environment variable.

The entry point for the Official Composer Image is /  Below is my modifications:


Finally some PowerShell script to make running composer easy, put these somewhere in your path “echo $Env:Path”:




Change “jstormes/composer” in the PowerShell scripts to your own image created from the Dockerfile.  Put the PowerShell scripts somewhere in your path.

If you do not have ssh keys in your ~/.ssh you can generate them using the run PoserShell script:

When asked where to put the files use “.”.

Testing your SSH key with git:

You should see something like:

Welcome to GitLab, James Stormes!

To clone a project using the Docker container:

To run composer cd into the directory you cloned and run:

To update run: