312-97 practice question 11 of 35

(Evan Peters has been working as a DevSecOps engineer in an IT company located in Denver, Colorado. His organization has deployed various applications on Docker containers. Evan has been running SSH service inside the containers, and handling of SSH keys and access policies is a major security concern for him. What will be the solution for Evan security concern?)

Full set: 100 questions
Answer options
A: Run SSH on the registry and utilize docker exec for interacting with the container.
B: Run SSH on the docker build and utilize docker exec for interacting with the container.
C: Run SSH on the client and utilize docker exec for interacting with the container.
D: Run SSH on the host and utilize docker exec for interacting with the container. Correct answer
Correct Answer:
D. Run SSH on the host and utilize docker exec for interacting with the container.
Explanation

Running an SSH daemon inside every container is a security anti-pattern. It unnecessarily increases the container's attack surface and complicates credential management. The best practice is to run the SSH service on the host machine and use the docker exec command to gain interactive shell access to a running container (e.g., docker exec -it /bin/sh). This approach centralizes access control, logging, and security hardening on the host, leveraging its mature security mechanisms rather than introducing a potential vulnerability into each container.

Why Incorrect

A: A Docker registry is a storage system for Docker images; it does not run containers or SSH services. B: docker build is the process of creating an image from a Dockerfile and is not a runtime environment. C: The SSH service is a server-side daemon that must run on the machine hosting the containers, not the client.

References

Docker Inc. (2019, September 19). "Docker security." Docker Documentation. Section: "Container security". Retrieved from https://docs.docker.com/engine/security/. (This documentation advises on minimizing the attack surface within containers).

Badger, L., Grance, T., Patt-Corner, R., & Voas, J. (2017). NIST Special Publication 800-190: Application Container Security Guide. National Institute of Standards and Technology. Section 4.4.2, "Disabling Unnecessary Services in Containers". (This guide recommends minimizing the number of services running inside a container).

Scroll to Top