Docker nodeJS node

My notes on using Git, NodeJS with official docker image:


  1. When you use -v / --volume, the directory will be created if not exists
  2. Bear in mind: NodeJS DID NOT have a server.  Unlike Apache.  So it is OK to use -v to mount a directory directly and run npm install and npm start
  3. To start: git clone <url> <target_dir>
  4. run the docker-compose.yml by running: sudo docker-compose -f <path_to_my_docker-compose.yml> up.
  5. In the above command, you can add '-d' at the end to run it on background.
  6. In docker-compose, if you want to run multiple commands, run this: command: bash -c "your_command" (reference).
  7. If you prefer using native docker statement: sudo docker run -it -d --name nodejs --rm -v <your_host_directory>:<your_docker_container_directory> -p 80:80 node:latest bash -c "npm install && npm start"
  8. Still not sure how to connect to webpack-dev-server inside container which the docker host is also a VM.

Comments

Popular posts from this blog

TCPDF How to show/display Chinese Character?

How to fix fancy box/Easy Fancybox scroll not work in mobile

Wordpress Load balancing: 2 web servers 1 MySQL without any Cloud services