Which command is used to check the installed version of Docker?
docker --check
docker --version
docker --info
docker -v
Answer: b) docker --version
How do you start a Docker container?
docker run [container_id]
docker start [container_id]
docker init [container_id]
docker create [container_id]
docker start [container_id]
Which command lists all running Docker containers?
docker ps -a
docker ls
docker ps
docker list
Answer: c) docker ps
Which command lists all Docker containers, including stopped ones?
docker ls -a
docker ps -a
docker list -a
docker all
Answer: b) docker ps -a
What does CMD instruction in Dockerfile do?
Answer: c) Provides the default command to run when a container starts
What does ENTRYPOINT instruction in Dockerfile do?
Answer: c) Provides the command to run when a container starts and cannot be overridden
What does the FROM instruction in Dockerfile specify?
Answer: b) The base image to use for creating the Docker image
Which Dockerfile instruction sets the working directory for subsequent instructions?
Answer: a) WORKDIR
Which Dockerfile instruction is used to copy files from host to container?
Answer: b) COPY
What is the difference between COPY and ADD instruction in Dockerfile?
Answer: a) ADD can copy files from a URL, COPY cannot
Which command is used to build a Docker image from a Dockerfile?
docker create
docker build
docker compile
docker make
Answer: b) docker build
Which command is used to remove a Docker container?
docker rm [container_id]
docker delete [container_id]
docker remove [container_id]
docker rmi [container_id]
docker rm [container_id]
Which command is used to remove a Docker image?
docker rm [image_id]
docker delete [image_id]
docker rmi [image_id]
docker remove [image_id]
docker rmi [image_id]
What is the default name of the Dockerfile?
Answer: b) Dockerfile
Which command is used to view the logs of a running container?
docker logs [container_id]
docker showlogs [container_id]
docker viewlogs [container_id]
docker log [container_id]
docker logs [container_id]
What does the RUN instruction do in a Dockerfile?
Which command is used to stop a running Docker container?
Which of the following command is used to push a Docker image to a registry?
What is the purpose of the EXPOSE instruction in a Dockerfile?