Skip to content

๐Ÿ–๏ธ Basic NodeJS Docker Example ๐Ÿ–๏ธ

License

Notifications You must be signed in to change notification settings

cogsmith/helloworld-nodejs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

56 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿ–๏ธ HELLOWORLD: Basic NodeJS Docker Example ๐Ÿ–๏ธ

Minimal example script for testing NodeJS and Docker instances




No Server Show Message And Exit

docker run --rm --name hello cogsmith/helloworld-nodejs

# HELLOWORLD: 695144B4BC64 @ 2021-02-18T01:19:03.199Z

Local Web Server @ Port 99

docker run -d --rm --name hellolocal --env PORT=9 -p 127.0.0.1:99:9 cogsmith/helloworld-nodejs ; sleep 1 ; curl http://127.0.0.1:99

# HELLOWORLD: 88ECF5397338 @ 0.0.0.0:80 @ 127.0.0.1:99 @ 2021-02-18T01:19:21.288Z

Public Web Server @ Port 80

docker run -d --rm --name helloworld --env PORT=9 -p 0.0.0.0:80:9 cogsmith/helloworld-nodejs ; sleep 1 ; curl http://localhost:80

# HELLOWORLD: 7A36215AC9D8 @ 0.0.0.0:80 @ LOCALHOST @ 2021-02-18T01:19:51.723Z

Clean Up

docker stop hello ; docker stop hellolocal ; docker stop helloworld ; docker rm hello ; docker rm hellolocal ; docker rm helloworld ; docker rmi cogsmith/helloworld-nodejs