first image should be provided

FROM node:latest



# 2nd step is to copy the

# copy source destination

# COPY index.js /home/myapp/index.js

COPY . /home/myapp

# copy everything

COPY package.json /home/myapp/package.json

# need to switch to the app directory to run

WORKDIR /home/myapp

RUN yarn install

EXPOSE 8000

CMD ["node","index"]

How to publish the docker container to docker hub ?

Need to have account at docker hub

docker build -t <dockerusername>/<appname> .


next

docker push <username>/appname

Stop docker

docker stop <containerId>




Delete docker

docker container rm <containerId>