Skip to content

Run As User: docker run

Michael Kenney edited this page Mar 17, 2018 · 6 revisions

A simple docker run solution for accessing private repositories via public key authentication that works for most use-cases.

$ set -x \
    docker run --rm -it \
        -v $(pwd):/src:rw \

        # Used in linux environments with a local Docker daemon
        # running as root
        -v $HOME/.ssh:/home/dev/.ssh:ro \

        # Used in Docker for Mac (and I assume similar) environments
        -v $HOME/.ssh:/root/.ssh:ro \

        mkenney/npm:node-8-alpine npm install

About the run-as-user script

Public key access to private repositories

Specify UID and GID values

Override the run-as-user script entirely

Clone this wiki locally