Coder Social home page Coder Social logo

docker-node-hello-world's Introduction

Docker + Node "Hello World" Example

This repository gives you a quick introduction to getting docker running with Node. It is intended for the Docker beginner.

You can adapt the same approach to other languages but I chose Node because it's what I use most often.

Setup

First, checkout this project locally and then follow these steps:

  1. Go through the Docker installation and getting started guide before you start.
  2. Install the Docker Toolbox.
  3. Start a "Quickstart Terminal" session (see the getting started guide).
  4. Build the Docker image: docker build -t hello-world .
  5. 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.
  1. View your new container: docker ps -a
  2. Check the logs for your container: docker logs <container-id>
  3. Check the port of the container: docker port <container-id>
  4. Open the app running on the docker machine: open http://$(docker-machine ip default):4001

Notes & Tips

  • If you make changes to your application, you will need to rebuild your image and restart your container.
  • The docker-machine command controls the virtual machine that is running Docker on your machine.
  • 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>

Further Reading

Credits and License

Put together by Dana Woodman and released under the MIT license. Have fun!

docker-node-hello-world's People

Contributors

danawoodman avatar danielbaird avatar tiwarishub avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.