A configurable Docker container for running Node; designed for use with AWS ElasticBeanstalk! :P
10K+
A configurable Docker container for running Node; designed for use with AWS ElasticBeanstalk! :P
This is a minimal Docker image for running Node in a customizable manner, by making use of a bash script with hooks as the container's entrypoint. This container supports arbitrary methods of starting your node process, as well as auto-pre-installation of npm dependencies prior to startup. It's meant primarily as a workaround for AWS ElasticBeanstalk's lack of a way to specify a run command for a Docker container, and is intended for the nodejs app to be included via a docker-mounted directory to /var/app.
docker pull vixlet/node:latestdocker run -d \
-p 8080:8080 \
-v $( pwd ):/var/app \
--name "vixlet-node-example" \
vixlet/node:latest
docker run -it --rm \
-p 8080:8080 \
-v $( pwd ):/var/app \
--name "vixlet-node-example" \
vixlet/node:latest
#### START WITH A CUSTOM NPM SCRIPT
docker run -it --rm \
-p 8080:8080 \
-v $( pwd ):/var/app \
--name "vixlet-node-example" \
vixlet/node:latest \
npm run my-custom-start-script
#### START WITH INCLUDED FOREVER.JS
docker run -it --rm \
-p 8080:8080 \
-v $( pwd ):/var/app \
--name "vixlet-node-example" \
vixlet/node:latest \
forever start -c "npm start"
#### START WITH INCLUDED NODEMON.JS
docker run -it --rm \
-p 8080:8080 \
-v $( pwd ):/var/app \
--name "vixlet-node-example" \
vixlet/node:latest \
nodemon
A custom pre-start script can be provided to handle any tasks prior to the container starting. To use a pre-start script, include an executable file in your application named docker-prestart.sh.
Alternatively, you can use an arbitrarily-named pre-start script by defining the environment variable
CONTAINER_PRESTART.
Setting the environment variable CONTAINER_PREINSTALL to "skip" will bypass the npm installation step of the container entrypoint script.
CONTAINER_PREINSTALL
"npm install --production --no-bin-links"CONTAINER_PRESTART "/var/app/docker-prestart.sh""skip"© 2014, 2015, 2016 VIXLET CA LLC <[email protected]>
The "ISC" license:
Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
Content type
Image
Digest
sha256:ef47f2796…
Size
85.9 MB
Last updated
almost 9 years ago
docker pull vixlet/node