Skip to content

Instantly share code, notes, and snippets.

@learnwell
Last active October 30, 2018 15:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save learnwell/953aa51d2322dad484178f3738513c71 to your computer and use it in GitHub Desktop.
Save learnwell/953aa51d2322dad484178f3738513c71 to your computer and use it in GitHub Desktop.
docker-compose template for using nodejs within a docker image without installing it on the host OS

Goal(s)

  • Use nodejs without installing it on the host OS
  • Use docker-compose to accomplish this

Step(s)

  1. On your local/remote machine:
    curl https://gist.githubusercontent.com/learnwell/953aa51d2322dad484178f3738513c71/raw/docker-compose.yml > docker-compose.yml`
    
  2. Run the container in an interactive bash shell:
    docker-compose run builder /bin/bash
    
  3. Code locally and save
  4. Run node inside the container
    node filename.js
    

Reference(s)

version: '3'
services:
builder:
image: node:10
volumes:
- .:/builder/
working_dir: /builder/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment