# Docker
```dockerfile=
#Dockerfile example
#Base image. Can be inherit from other images.
FROM node:12.18.1
ENV NODE_ENV=production
WORKDIR /app
COPY package*.json ./ #Alternatively COPY ["package.json", "package-lock.json*", "./"]
RUN npm install --production
COPY . .
# command we want to run when our image is run inside of a container
CMD [ "node", "server.js" ]
```
```bash=
#Build image
# the '.' (dot) is the context so that the build process can access any of those files
docker build --tag node-docker .
# list images
docker images
#publish detached (background)
docker run -d -p [host port]:[container port] image-name container-name
#interactive shell
docker run -it alpine /bin/sh
```