Skip to content

Run As User: Compose

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

A simple docker-compose dev build solution for accessing private repositories that works for most use-cases. The important point is that the ~/.ssh directory is mounted into both the dev and root user's home directories.

version: '2'
services:
    httpd:
        container_name: "http"
        build:
            context: .
            dockerfile: Dockerfile
        volumes:
            - .:/var/www/html/
    npm:
        container_name: "http.npm"
        image: mkenney/npm
        volumes:
            - .:/src
            - ~/.ssh:/home/dev/.ssh:ro
            - ~/.ssh:/root/.ssh:ro
        command: ["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