Skip to content

Instantly share code, notes, and snippets.

@korayguclu
Last active March 17, 2018 20:00
Show Gist options
  • Save korayguclu/3ce688687336407661651a1fab53b064 to your computer and use it in GitHub Desktop.
Save korayguclu/3ce688687336407661651a1fab53b064 to your computer and use it in GitHub Desktop.
Build Docker image

Create a simple nodejs hello world application

Add following Dockerfile

FROM node:8.10-alpine

MAINTAINER Koray Güclü

COPY . /var/www

WORKDIR /var/www

EXPOSE 3000
ENTRYPOINT ["npm","start"]

build docker image

docker build -t <username>/node-demo .

run docker image

docker run -p 8080:3000 <username>/node-demo

to test a build first build by using following command. demo is container's name tag

docker build -t demo -f Dockerfile-example . 

to check your image and remove container on exit use following command

docker run --rm -it demo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment