What does the COPY instruction do in a Dockerfile?
COPY
Sets the working directory for subsequent instructions.
Copies files or directories from the host machine to the image.
Exposes a port from the container to the host.
Executes a command within the Docker image.
When should you consider using the 'host' network mode for a Docker container?
When you want to limit the container's network access for security reasons
When you need to run a network monitoring tool inside the container
When you need to expose multiple ports from the container
When you want to connect the container to a specific VLAN on the host
How do Docker containers differ from virtual machines?
Containers share the host kernel, while VMs have their own.
Containers are used only for development, while VMs are for production.
Containers cannot run on the cloud.
Containers require more resources than VMs.
Where can you find pre-built Docker images for common software?
Amazon S3
GitHub repositories
Microsoft Azure Blob Storage
Docker Hub
What is the primary benefit of using a user-defined bridge network over the default bridge network in Docker?
Improved performance by using a faster networking protocol
Reduced resource consumption by sharing network resources
Increased security by isolating containers on different networks
Simplified management by automatically connecting all containers to a single network
How do you specify the Docker image to be used for a service in 'docker-compose.yml'?
container:
image:
build:
from:
After stopping a container, you want to remove it completely. What command should you use?
docker remove
docker rm
docker erase
docker delete
What is a potential drawback of using the 'host' network mode in Docker?
Reduced security as the container can access all ports and resources on the host
Limited network performance due to sharing the host's network bandwidth
Increased network overhead due to network address translation (NAT)
Increased complexity in configuring network settings for the container
Which command completely removes a Docker container?
docker stop -r <container_id>
docker delete <container_id>
docker rm <container_id>
docker kill <container_id>
What is the primary purpose of Docker Compose?
Storing Docker images in a central repository
Building individual Docker images
Deploying Docker containers to production servers
Defining and managing multi-container Docker applications