how to build a dockerfile code example
Example 1: docker build
docker build -t [tag] .
Example 2: how to build docker image
docker build <Dockerfile path> -t image-name
Example 3: docker build from dockerfile
$ docker build - < Dockerfile
Example 4: how to create docker image from custom filename
cat DockerFile.debian.foo | docker build -t debian.foo -
Example 5: how run dockerfile
FROM node:current-slim
WORKDIR /usr/src/app
COPY package.json .
RUN npm install
EXPOSE 8080
CMD [ "npm", "start" ]
COPY . .
Example 6: command to build docker file
// Make sure you are in the same dictionary where you have saved your Dockerfile
command is:
docker build .