Developing Applications and Automating Workflows Using Cisco Platforms (DEVASC) — Question 219
A developer created a new secure API and is testing the functionality locally. The API was added to a container for further testing, and other team members and applications need to connect to the API. Which command exposes the API in the container as port 8443 and allows connections external to the host?
Answer options
- A. docker run -p 127.0.0.1:80:8443/tcp myapiservice
- B. docker run -p 0.0.0.0:443:8443/tcp myapiservice
- C. docker run -p 0.0.0.0:8443:443/tcp myapiservice
- D. docker run -p 127.0.0.1:443:8443/tcp myapiservice
Correct answer: C
Explanation
The correct command is C because it maps the container's port 443 to the host's port 8443, allowing external access. Option A restricts connections to localhost only, while option B incorrectly maps the host's port 443 to the container's port 8443, and option D also limits access to localhost, preventing external connectivity.