To start a bash prompt with only Docker installed on your host OS, run the following command:
docker run --rm -v $PWD:/src -w /src -u node -it node /bin/bash
Here's what each parameter does:
--rm
removes the container once youexit
-v $PWD:/src
will mount your current host working directory into/src
inside the container-w /src
will set the working directory of the container to/src
-u node
will set the user/UID tonode
-it
will enable interactive mode (keep STDIN open) and allocate a pseudo-TTYnode
is the latest node docker image/bin/bash
is the command that will be run
From there, you'll be able to run commands like node
, npm
and yarn
without having to install them locally.