DCA practice question 1 of 25
Does this command create a swarm service that only listens on port 53 using the UDP protocol? Solution. ‘docker service create -name dns-cache -p 53:53 -udp dns-cache’
Full set: 191 questionsThe command is syntactically incorrect and will not achieve the desired outcome. The --publish or -p flag defaults to the TCP protocol. To specify the UDP protocol, the /udp suffix must be appended directly to the port mapping. The provided command uses -p 53:53, which implies TCP, and then adds a standalone -udp flag, which is not a valid flag for the docker service create command. This will result in a command-line error or unexpected behavior, but not a UDP-only service.
A. The command uses an invalid flag (-udp) and fails to use the correct syntax (-p 53:53/udp) to specify the UDP protocol for the port mapping.
1. Docker Docs, docker service create command reference. The --publish flag section details the syntax. It states, "By default, the docker service create command publishes ports on the TCP protocol. To publish a port on the UDP protocol, add a /udp suffix to the port number." (https://docs.docker.com/engine/reference/commandline/servicecreate/#publish-service-ports-externally-to-the-swarm--p---publish)
2. Docker Docs, Swarm mode tutorial, "Open a port on a swarm". This guide shows the correct syntax for publishing ports, including the /udp suffix for UDP ports. (https://docs.docker.com/engine/swarm/swarm-tutorial/open-service-port/)
Keep practicing
Take the free DCA practice test
Ten exam-style questions with answers and explanations, plus the exam facts and study guides.
More questions
Other DCA practice questions
- Question 2Will this command ensure that overlay traffic between service tasks is encrypted? Solutio…
- Question 4Does this describe the role of Control Groups (cgroups) when used with a Docker container…
- Question 5Can this set of commands identify the published port(s) for a container? Solution: docker…
- Question 6Will this command mount the host's '/data' directory to the ubuntu container in read-only…
- Question 7A company's security policy specifies that development and production containers must run…
- Question 9Will this action upgrade Docker Engine CE to Docker Engine EE? Solution: Uninstall 'docke…
