General Docker IV
1.
What is the purpose of the 'ENTRYPOINT' instruction in a Dockerfile?
To set environment variables
To define the base image
To specify the working directory
To configure the primary command to run when the container starts
2.
How do you enable user namespace remapping in Docker?
Edit the /etc/docker/userns-remap file
Add the '--userns-remap' option to the Docker daemon configuration
Run the 'docker enable-userns-remap' command
Set the 'DOCKER_USERNS_REMAP' environment variable to 'true'
3.
How do you pause and unpause a running Docker container?
docker suspend and docker resume
docker freeze and docker unfreeze
docker stop and docker start
docker pause and docker unpause
4.
How can you run a command inside a Docker container as a different user with a specific username?
docker run -u username command container_id
docker exec -u username container_id command
docker execute -u username container_id command
docker start -u username container_id command
5.
What is the purpose of Docker Hub?
To create Docker networks
To manage Docker containers
To provide cloud-based storage for Docker volumes
To share and distribute Docker images
6.
What is the role of the Docker client in the Docker architecture?
To manage Docker images
To execute Docker commands and communicate with the Docker daemon
To store Docker containers
To orchestrate Docker deployments
7.
What is the default storage driver used by Docker on Windows?
overlay2
aufs
btrfs
vfs
8.
What is the purpose of the --link option when running a Docker container?
To link containers and allow them to communicate
To expose a container to the host network
To specify the container's network mode
To create a new network for the container
9.
What is the purpose of the 'LABEL' instruction in a Dockerfile?
To set environment variables
To specify metadata for an image
To define the working directory
To configure the container's entry point
10.
What is the purpose of the '--mount' option when running a Docker container?
To create a new volume
To mount a volume
To specify the container's network mode
To expose the container to the host network
11.
How can you build a Docker image with a specific tag?
docker build -n image_name:tag
docker tag -t image_name:tag
docker create -t image_name:tag
docker build -t image_name:tag
12.
What is the purpose of the 'TMPDIR' environment variable in Docker?
To set the temporary directory for Docker containers
To configure the image layers
To specify the base image
To define the working directory
13.
How can you remove all Docker images from the local machine?
docker image prune -a
docker rmi -f $(docker images -q)
docker clean images
docker purge -a
14.
How can you set environment variables in a running Docker container?
docker run -e
docker set-env
docker export-env
docker env-set
15.
How can you list all Docker networks on a host?
docker list networks
docker network ls
docker show networks
docker inspect networks
16.
How do you specify a custom Dockerfile name when building an image?
docker build -n custom.Dockerfile
docker build -n custom.Dockerfile
docker build --file custom.Dockerfile
docker build --name custom.Dockerfile
17.
How can you remove all Docker containers, including running ones?
docker prune containers
docker clear
docker rm -f $(docker ps -aq)
docker remove all
18.
How can you view the real-time resource usage of a running Docker container?
docker show stats
docker top
docker monitor
docker stats
19.
How do you inspect the logs of a specific container in a Docker Swarm service?
docker inspect logs
docker logs service
docker swarm logs
docker service logs
20.
How can you limit the memory usage of a Docker container?
docker mem-limit
docker set-mem
docker limit-mem
docker run --memory