This repository gives you a quick introduction to getting docker running with Node. It is intended for the Docker beginner.
####$ Setup
First, checkout this project locally and then follow these steps:
- Install the Docker for Windows.
- Start a Quickstart Terminal session (see the getting started guide).
- Build the Docker image:
docker build -t hello-world .
- Run the image in a container:
docker run -d -p 4001:4000 hello-world
- The
-d
flag says to run the container in the background (daemon mode). - The
-p
flag maps port 4000 from the container to port 4001 on the docker machine.
- View your new container:
docker ps -a
- Check the logs for your container:
docker logs <container-id>
- Check the port of the container:
docker port <container-id>
- Open the app running on the docker machine:
open http://localhost:4001
- If you make changes to your application, you will need to rebuild your image and restart your container.
- View logs for a docker container:
docker logs <container-id>
- List the running containers:
docker ps -a
- List all local images:
docker images
- Remove an image:
docker rmi <image-id>
- Remove a container:
docker rm <container-id>