Practice Free 305-300 Exam Online Questions
If docker stack is to be used to run a Docker Compose file on a Docker Swarm, how are the images referenced in the Docker Compose configuration made available on the Swarm nodes?
- A . docker stack builds the images locally and copies them to only those Swarm nodes which run the service.
- B . docker stack passes the images to the Swarm master which distributes the images to all other Swarm nodes.
- C . docker stack instructs the Swarm nodes to pull the images from a registry, although it does not upload the images to the registry.
- D . docker stack transfers the image from its local Docker cache to each Swarm node.
- E . docker stack triggers the build process for the images on all nodes of the Swarm.
C
Explanation:
Docker stack is a command that allows users to deploy and manage a stack of services on a Docker Swarm cluster. A stack is a group of interrelated services that share dependencies and can be orchestrated and scaled together. A stack is typically defined by a Compose file, which is a YAML file that describes the services, networks, volumes, and other resources of the stack. To use docker stack to run a Compose file on a Swarm, the user must first create and initialize a Swarm cluster, which is a group of machines (nodes) that are running the Docker Engine and are joined into a single entity. The Swarm cluster has one or more managers, which are responsible for maintaining the cluster state and orchestrating the services, and one or more workers, which are the nodes that run the services.
When the user runs docker stack deploy with a Compose file, the command parses the file and creates the services as specified. However, docker stack does not build or upload the images referenced in the Compose file to any registry. Instead, it instructs the Swarm nodes to pull the images from a registry, which can be the public Docker Hub or a private registry. The user must ensure that the images are available in the registry before deploying the stack, otherwise the deployment will fail. The user can use docker build and docker push commands to create and upload the images to the registry, or use an automated build service such as Docker Hub or GitHub Actions. The user must also make sure that the image names and tags in the Compose file match the ones in the registry, and that the Swarm nodes have access to the registry if it is private. By pulling the images from a registry, docker stack ensures that the Swarm nodes have the same and latest version of the images, and that the images are distributed across the cluster in an efficient way.
The other options are not correct. Docker stack does not build the images locally or on the Swarm nodes, nor does it copy or transfer the images to the Swarm nodes. Docker stack also does not pass the images to the Swarm master, as this would create a bottleneck and a single point of failure. Docker stack relies on the registry as the source of truth for the images, and delegates the image pulling to the Swarm nodes.
Reference: Deploy a stack to a swarm | Docker Docs1
docker stack deploy | Docker Docs2
docker build | Docker Docs3
docker push | Docker Docs4
FILL BLANK
What LXC command starts a new process within a running LXC container? (Specify ONLY the command without any path or parameters.)
Explanation:
The lxc-attach command allows the user to start a new process within a running LXC container12. It takes the name of the container as an argument and optionally a command to execute inside the container. If no command is specified, it creates a new shell inside the container1.
For example, to list all the files in the home directory of a container named myContainer, one can use:
lxc-attach -n myContainer C ls -lh /home
Reference: 1: Executing a command inside a running LXC – Unix & Linux Stack Exchange
If a Dockerfile contains the following lines:
WORKDIR /
RUN cd /tmp
RUN echo test > test
where is the file test located?
- A . /ting/test within the container image.
- B . /root/tesc within the container image.
- C . /test within the container image.
- D . /tmp/test on the system running docker build.
- E . test in the directory holding the Dockerf ile.
C
Explanation:
The WORKDIR instruction sets the working directory for any subsequent RUN, CMD, ENTRYPOINT, COPY and ADD instructions that follow it in the Dockerfile1. The RUN instruction executes commands in a new layer on top of the current image and commits the results2. The RUN cd command does not change the working directory for the next RUN instruction, because each RUN command runs in a new shell and a new environment3. Therefore, the file test is created in the root directory (/) of the container image, not in the /tmp directory.
Reference: Dockerfile reference: WORKDIR
Dockerfile reference: RUN
difference between RUN cd and WORKDIR in Dockerfile
A clone of a previously used virtual machine should be created. All VM specific information, such as user accounts, shell histories and SSH host keys should be removed from the cloned disk image.
Which of the following tools can perform these tasks?
- A . virc-reset
- B . virt-sparsi
- C . virt-rescue
- D . virt-svspre
- E . sysprep
- F . vire-wipe
E
Explanation:
Sysprep is a tool that removes all your personal account and security information, and then prepares the machine to be used as an image. It is supported by Windows and some Linux distributions. It can also remove drivers and other machine-specific settings. Sysprep is required when creating a managed image outside of a gallery in Azure
https://learn.microsoft.com/en-us/azure/virtual-machines/generalize
Which disk image formats are commonly used in Linux-based virtualization environments? (Select all that apply)
- A . RAW
- B . VMDK
- C . QCOW2
- D . VHD
A, B, C, D
Explanation:
Linux-based virtualization environments support a wide range of disk image formats to ensure compatibility with multiple hypervisors and cloud platforms. According to virtualization documentation, RAW, VMDK, QCOW2, and VHD are all commonly used formats.
RAW images are simple, unstructured disk files that offer maximum performance due to minimal overhead. QCOW2 (QEMU Copy-On-Write version 2) is the most widely used format in KVM environments because it supports advanced features such as snapshots, thin provisioning,
compression, and encryption. VMDK is the native disk format for VMware products but is frequently used in Linux environments for interoperability and migration purposes. VHD is commonly associated with Microsoft Hyper-V but is also supported by QEMU and cloud platforms.
Virtualization notes emphasize that modern Linux virtualization tools like QEMU and libvirt are designed to work across multiple disk formats. This flexibility enables administrators to migrate workloads between different hypervisors and cloud providers without rebuilding virtual machines.
Therefore, all listed disk image formats are valid and commonly supported in Linux-based virtualization environments.
What is the purpose of the kubelet service in Kubernetes?
- A . Provide a command line interface to manage Kubernetes.
- B . Build a container image as specified in a Dockerfile.
- C . Manage permissions of users when interacting with the Kubernetes API.
- D . Run containers on the worker nodes according to the Kubernetes configuration.
- E . Store and replicate Kubernetes configuration data.
D
Explanation:
The purpose of the kubelet service in Kubernetes is to run containers on the worker nodes according to the Kubernetes configuration. The kubelet is an agent or program that runs on each node and communicates with the Kubernetes control plane. It receives a set of PodSpecs that describe the desired state of the pods that should be running on the node, and ensures that the containers described in those PodSpecs are running and healthy. The kubelet also reports the status of the node and the pods back to the control plane. The kubelet does not manage containers that were not created by Kubernetes.
Reference: Kubernetes Docs – kubelet
Learn Steps – What is kubelet and what it does: Basics on Kubernetes
FILL BLANK
What LXC command lists containers sorted by their CPU, block I/O or memory consumption? (Specify ONLY the command without any path or parameters.)
Explanation:
LXD supports the following network interface types for containers: macvlan, bridged, physical, sriov, and ovn1. Macvlan creates a virtual interface on the host that is connected to the same network as the parent interface2. Bridged connects the container to a network bridge that acts as a virtual switch3. Physical attaches the container to a physical network interface on the host2. Ipsec and wifi are not valid network interface types for LXD containers.
Reference: 1: Bridge network – Canonical LXD documentation
2: How to create a network – Canonical LXD documentation
4: LXD containers and networking with static IP – Super User
In order to use the option dom0_mem to limit the amount of memory assigned to the Xen Domain-0, where must this option be specified?
- A . In the bootloader configuration, when Xen is booted.
- B . In any of Xen’s global configuration files.
- C . In its .config file, when the Domain-0 kernel is built.
- D . In the configuration file /etc/xen/Domain-0.cfg, when Xen starts.
- E . In its Makefile, when Xen is built.
A
Explanation:
The option dom0_mem is used to set the initial and maximum memory size of the Domain-0, which is the privileged domain that starts first and manages the unprivileged domains (DomU) in Xen. The option dom0_mem must be specified in the bootloader configuration, such as GRUB or GRUB2, when Xen is booted. This ensures that the Domain-0 kernel can allocate memory for storing memory metadata and network related parameters based on the boot time amount of memory. If the option dom0_mem is not specified in the bootloader configuration, the Domain-0 will use all the available memory on the host system by default, which may cause performance and security issues.
Reference: Managing Xen Dom0′s CPU and Memory
Xen Project Best Practices
Dom0 Memory ― Where It Has Not Gone
