Skip to content

Docker image for node-js, running with the traefik service

Notifications You must be signed in to change notification settings

thiagoelg/nodejs-docker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 

Repository files navigation

NodeJS simple docker-compose testing environment

Docker image for node-js, runing with the traefik service, mysql and phpmyadmin

Prerequisites

You will need both Docker, docker-compose and Nodejs with NPM.

- Installing Docker

https://www.digitalocean.com/community/tutorials/how-to-install-and-use-docker-on-ubuntu-16-04

- Installing docker-compose

https://www.digitalocean.com/community/tutorials/how-to-install-docker-compose-on-ubuntu-16-04

- Installing latest nodejs + npm

https://github.com/creationix/nvm#install-script

Preparing your environment

We need to edit our hosts file so our machine recognize the traefik domains we will be using. As ou can see in the docker-compose.yml, traefik is using localhost.node and localhost.phpmyadmin.

Edit your hosts file with the following command:

sudo nano /etc/hosts

Then, add these lines:

127.0.0.1 localhost.node

127.0.0.1 localhost.phpmyadmin

Save and exit.

Running your server

  • Install node dependencies:

cd app && npm install && cd ..

  • Create the docker network used by the containers:

docker network create node

  • Then run your server with:

sudo docker-compose up

  • Or run it in the background with:

sudo docker-compose up -d

Stopping your server

  • To simply and gently stop:

sudo docker-compose stop

  • To discard everything changed in the cointainers and reset them:

sudo docker-compose down

About

Docker image for node-js, running with the traefik service

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published