Complete the Dockerfile line to set the base image for a development container.
FROM [1]The FROM instruction sets the base image. Here, node:18-alpine is a lightweight Node.js image suitable for development.
Complete the Dockerfile command to copy local source code into the container.
COPY [1] /app/src which don't exist in the build context.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 update which updates packages but does not install new ones.The correct command to install dependencies is npm install. Other options do not install packages.
Fill both blanks to expose port 3000 and set the default command to start the app.
EXPOSE [1] CMD ["npm", "[2]"]
npm build which only compiles code.Port 3000 is commonly used for development servers. The command npm start runs the start script defined in package.json.
Fill all three blanks to create a volume mount for live code editing and set environment variable for development mode.
VOLUME ["[1]"] ENV NODE_ENV=[2] CMD ["npm", "[3]"]
Mounting /app allows live code changes inside the container. Setting NODE_ENV=development enables dev mode. Running npm start launches the app.