![]() bootstrap.sh file to run when the container is startedĤ. My own sources are part of the GitHub Repository at – with resources for a workshop on Microservices, Choreography, Docker, Kubernetes, Node.jS, Kafka and more.Ģ. Note: this work is based on the Docker Image created by jakubknejzlik – see and. The same image is started, passing a different GIT_URL and different instructions regarding the directory and the script to run – and also a different environment variable called PORT. To run an entirely different Node.js application, I can use this command:ĭocker run -e “GIT_URL= ” -p 8010:8888 -e”PORT=8888″ -e “APP_HOME=.” -e “APP_STARTUP=app.js” lucasjellema/node-app-runner ![]() It maps port 8080 inside the container to port 8005 on the host in the standard Docker way. It passes an additional environment variable APP_PORT to the runtime – to be used in the node application (_PORT). This command will run the script requestCounter.js in the part1 directory in the repo found in GitHub at the URL specified. An example of the command line to use:ĭocker run -e “GIT_URL=” -e “APP_PORT=8080” -p 8005:8080 -e “APP_HOME=part1” -e “APP_STARTUP=requestCounter.js” lucasjellema/node-app-runner When a container is run from this image, the url for the GitHub Repo is passed in as environment variable – as well as (optionally) the directory in the repo to run the application from, the name of the file to run and the specific version of the Node runtime to use. The usage of this image is shown in this picture:Īny Node.JS application in any public GitHub repo can be run using this Docker Container Image. This article shows how I create a generic Docker Container Image to run any Node.JS application based on sources for that application on GitHub.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |