Q31
Q31 After installing Docker, you see a 'Permission Denied' error when running a Docker command. What should you do?
Reinstall Docker
Restart Docker
Add your user to the Docker group
Run Docker as root
Q32
Q32 Which Dockerfile instruction is used to specify the base image?
RUN
FROM
CMD
ENTRYPOINT
Q33
Q33 What is the default storage driver used by Docker on Linux?
aufs
overlay2
btrfs
zfs
Q34
Q34 What is the purpose of the ADD instruction in Dockerfile?
Copies files to the container
Runs commands inside the container
Exposes ports
Sets environment variables
Q35
Q35 What does the CMD instruction in Dockerfile specify?
The base image
Default command to run in the container
Environment variables
Networking configuration
Q36
Q36 What is a multi-stage build in Docker?
A single-stage Dockerfile
A way to create lightweight images
A process for creating containers
A debugging mechanism
Q37
Q37 What is the main difference between COPY and ADD in Dockerfile?
ADD is faster than COPY
COPY allows unpacking tar files
ADD can copy files from a URL
COPY exposes ports
Q38
Q38 How do you list all Docker images on your system?
docker ps
docker images
docker list
docker inspect
Q39
Q39 How do you remove an unused Docker image?
docker remove
docker rmi
docker clean
docker prune
Q40
Q40 How do you build a Docker image using a Dockerfile?
docker create -f Dockerfile
docker run -f Dockerfile
docker build -t
docker image create Dockerfile
Q41
Q41 What should you check if a Docker image build fails?
Check the image version
Check the Dockerfile syntax
Check the container logs
Check the Docker network
Q42
Q42 An image build fails with the error 'no space left on device.' What should you do?
Restart Docker
Remove unused images and containers
Increase system storage
Rebuild the image
Q43
Q43 An image build fails due to missing dependencies. How can this be resolved?
Add dependencies in the Dockerfile
Restart the system
Rebuild the container
Remove the image
Q44
Q44 What is the role of namespaces in Docker containers?
To provide isolated file systems
To share resources across containers
To manage container logs
To configure container networks
Q45
Q45 What happens to the data in a container when it is stopped?
The data is saved to a local database
The data is lost unless persisted using volumes
The data is automatically backed up
The data is synchronized with the host
Q46
Q46 Which command is used to stop a running Docker container?
docker halt
docker stop
docker terminate
docker shutdown
Q47
Q47 How do you check the logs of a running container?
docker logs
docker view
docker inspect
docker console
Q48
Q48 Which flag is used with 'docker run' to allocate a pseudo-TTY to a container?
-d
-p
-t
-it
Q49
Q49 What is the primary difference between a bind mount and a volume?
Volumes are created automatically
Bind mounts are stored in Docker's default storage
Volumes are managed by Docker while bind mounts rely on the host file system
Bind mounts cannot persist data
Q50
Q50 How do you run a container interactively?
docker start -i
docker run -it
docker create -it
docker run -d
Q51
Q51 How do you restart a stopped container?
docker start
docker restart
docker run
docker reload
Q52
Q52 How do you execute a command inside a running container?
docker exec -it
docker run
docker attach
docker run --exec
Q53
Q53 What should you check if a container fails to start?
Check the container logs
Restart the Docker service
Remove the image
Check the host network settings
Q54
Q54 You cannot connect to a service running in a container. What might be the issue?
The container is not running
The host port is not mapped to the container port
The container image is corrupted
The Docker CLI is outdated
Q55
Q55 A container is consuming too much memory. How can this be managed?
Increase system memory
Stop the container
Set resource limits using --memory
Rebuild the container
Q56
Q56 What is a Docker volume?
A temporary file system
A command-line tool
A mechanism to persist data
A network configuration
Q57
Q57 What is the default location for Docker volumes on Linux?
/var/lib/docker/volumes
/docker/volumes
/var/volumes
/docker-data
Q58
Q58 What is the primary benefit of using named volumes over anonymous volumes?
Better performance
Easier management and reusability
Faster creation
Automatic backup
Q59
Q59 Which command lists all Docker volumes?
docker volume show
docker volume list
docker volume ls
docker volumes
Q60
Q60 What is the primary difference between bind mounts and named volumes?
Bind mounts are stored in Docker's default location
Named volumes are stored outside the container
Bind mounts map to specific host paths while volumes are managed by Docker
Named volumes are temporary