A job defines services.redis with image redis:7. How should steps in the job typically reach Redis?
Select an answer to reveal the explanation.
Short Explanation and Infographic
Service id becomes the DNS name—connect to redis:6379 from job steps. localhost only works with host networking/port publish patterns; artifacts and api.github.com are unrelated.
Full explanation below image
Full Explanation
When you declare services under a job, Actions attaches them to a user-defined bridge network. The service key (redis) is the hostname other containers use. If the job runs in a container, application steps should use that hostname rather than assuming localhost. If the job runs directly on the VM, published ports may be available on localhost depending on configuration—but the portable pattern taught for service containers is hostname = service id. Service containers are not packaged as artifacts to become reachable, and api.github.com is not a database proxy. Provide health options so jobs wait until Redis accepts connections, and pass connection strings via env to keep apps configurable.