Fooling around with Docker and Node.js.
The bin/run script builds and runs the program.
$ bin/run
The following explains what the bin/run script does at a high level.
The actual script is more complex.
The -t flag tags the image so it is easier to find using the docker images command.
See The misunderstood Docker tag: latest.
$ docker build -t $USER/docker_node_fun .
$ # Manually provide a monotonically increasing tag number (from 1)
$ docker tag $USER/docker_node_fun $USER/docker_node_fun:1
The new image should now be visible:
$ docker images | grep docker_node_fun
mslinn/docker_node_fun 1 015ab51e9d36 About a minute ago 676MB
mslinn/docker_node_fun latest 015ab51e9d36 About a minute ago 676MB
Run the app:
$ docker run -d $USER/docker_node_fun
Get the container ID:
$ CONTAINER_ID=$(docker ps -l | tail -n 1 | cut -d ' ' -f1)
View app output:
$ docker logs $CONTAINER_ID
Hello, world
