General Docker VIII
1.
How can you view the detailed configuration of a Docker network?
docker network inspect network_name
docker network show network_name
docker view network_name
docker config network_name
2.
What is the purpose of the '--detach' option when running a Docker container?
To expose ports on the host
To detach from a running container
To run the container in interactive mode
To run the container in the background
3.
What is the purpose of the 'docker save' command?
To display Docker container logs
To export environment variables
To save a Docker container as an image
To save a Docker image as a tarball
4.
What is the purpose of the 'docker system' command?
To create Docker volumes
To configure Docker network settings
To show detailed information about running containers
To manage the Docker system
5.
How do you expose all ports from a Docker container to the host?
docker run --ports-all
docker run --expose-all
docker run --publish-all
docker run -P
6.
What is the purpose of the 'docker secret' command in Docker Swarm?
To manage sensitive data like passwords securely
To create encrypted Docker images
To deploy services in swarm mode
To share environment variables between containers
7.
How can you tag a Docker image with multiple tags during the build?
docker tag -t image_name:tag1 -t image_name:tag2
docker build -t image_name:tag1 -t image_name:tag2
docker build -t image_name:tag1,tag2
docker tag -t image_name:tag1,tag2
8.
How can you run a command inside a Docker container that has already exited?
docker exec -it container_id command
docker start -i container_id command
docker run -it --rm container_id command
docker attach container_id command
9.
How can you build a Docker image without using a cache during the build process?
docker build -f
docker build -nc
docker build --disable-cache
docker build --no-cache
10.
What does the 'docker-machine' tool do in Docker?
Manages Docker containers
Creates and manages Docker hosts
Builds Docker images
Orchestrates Docker deployments
11.
How do you limit the number of CPUs a Docker container can use?
docker set-cpus
docker limit-cpu
docker run --cpus
docker cpu-limit
12.
What is the purpose of the 'docker cp' command?
To copy files between a container and the host
To create a new Docker container
To compress Docker images
To customize the Docker build context
13.
How can you check the health status of a Docker container?
docker status container_id
docker health container_id
docker inspect --format '{{.State.Health.Status}}' container_id
docker show health container_id
14.
How do you specify the logging driver when running a Docker container?
docker configure-log
docker set-log-driver
docker run --log-driver
docker logging-driver
15.
What does the 'docker top' command display?
Information about running processes inside a container
Detailed configuration of a Docker network
Real-time resource usage of a running container
History of a Docker image
16.
How can you remove all unused Docker images?
docker image prune -a
docker rmi -f $(docker images -q)
docker purge images
docker remove -i $(docker images -q)
17.
What is the purpose of the '--cap-add' option when running a Docker container?
To add Linux capabilities to the container
To set the container's network mode
To expose the container to the host network
To assign a specific IP address to the container
18.
How can you set up a named Docker volume with specific options?
docker new volume --driver driver_name --name volume_name
docker create volume --driver driver_name --name volume_name
docker volume -d driver_name create volume_name
docker volume create --driver driver_name --name volume_name
19.
What is the purpose of the 'docker service' command in Docker Swarm mode?
To deploy Docker stacks
To configure Docker network settings
To create Docker volumes
To manage Docker services
20.
How can you run a command inside a Docker container as a different user with a specific UID and GID?
docker run -u uid:gid command container_id
docker exec -u uid:gid container_id command
docker execute -u uid:gid container_id command
docker start -u uid:gid container_id command