Complete the Dockerfile line to specify the base image for a Node.js microservice.
FROM [1]The FROM instruction sets the base image. For a Node.js microservice, node:18-alpine is a lightweight and common choice.
Complete the Dockerfile command to copy the application source code into the container.
COPY [1] /apppackage.json without source files.node_modules which should be installed inside the container.The COPY . /app command copies all files from the current directory into the container's /app folder.
Fix the error in the Dockerfile command to install dependencies using npm.
RUN npm [1]npm start which runs the app, not installs packages.npm build which is not a standard npm command.The RUN npm install command installs all dependencies listed in package.json.
Fill both blanks to expose the correct port and set the container's working directory.
WORKDIR [1] EXPOSE [2]
WORKDIR /app sets the working directory inside the container. EXPOSE 3000 tells Docker the app listens on port 3000.
Fill the blanks to define the command that starts the Node.js microservice.
CMD ["[1]", "[2]"]
The CMD instruction defines the command to run the app. Usually, node server.js starts the service. Using npm here is incorrect for this format.