300-910 · Question #90
An Ops team sets up a CI/CD pipeline for a Node.js application with GitLab. The latest node Docker image is defined as a service in a job. The team notices that the node commands are unavailable in th
The correct answer is A. Choose a Docker image that contains tools needed to run the node and define it as an image in the job.. When a Node.js Docker image is defined as a service in a GitLab CI/CD job, node commands are unavailable in the main job container because services run as separate linked containers, not the primary execution environment.
Question
Exhibit
Options
- AChoose a Docker image that contains tools needed to run the node and define it as an image in the job.
- BDefine a command or script to execute as the container entry point.
- CConfigure the service entry by using a map as an option.
- DSpecify a service alias that is used to access the service from the job container.
How the community answered
(38 responses)- A71% (27)
- B8% (3)
- C16% (6)
- D5% (2)
Why each option
When a Node.js Docker image is defined as a `service` in a GitLab CI/CD job, `node` commands are unavailable in the main job container because services run as separate linked containers, not the primary execution environment.
In GitLab CI/CD, the `image` keyword defines the Docker image for the primary job container where script commands are executed, while `services` define linked auxiliary containers. To make `node` commands available directly in the job's execution environment, the `image` for the job itself must be set to a Docker image (e.g., `node:latest`) that contains the Node.js runtime and necessary tools.
Defining an entry point command affects how the *service container* starts, but it does not make the `node` executable available within the *main job container* where the script is attempting to run `node` commands.
Configuring service entries with a map is for passing parameters or environment variables to the *service container*, which does not resolve the issue of the `node` command being absent in the *main job container*.
A service alias provides a hostname to access the service container from the main job container, but it does not install or make the `node` executable available within the main job container's environment.
Concept tested: GitLab CI/CD Docker image vs. service
Source: https://docs.gitlab.com/ee/ci/docker/using_docker_images.html#what-is-the-difference-between-image-and-services
Topics
Community Discussion
No community discussion yet for this question.
