Exam4Training

Does this command create a swarm service that only listens on port 53 using the UDP protocol?

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 -service udp dns-cache’
A . Yes
B . No

Answer: B

Explanation:

The command docker service create -name dns-cache -p 53:53 -service udp dns-cache is not valid because it has some syntax errors. The correct syntax for creating a swarm service is docker service create [OPTIONS] IMAGE [COMMAND] [ARG…].

The errors in the command are:

There should be a space between the option flag and the option value. For example, -name dns-cache should be -name dns-cache.

The option flag for specifying the service mode is -mode, not -service. For example, -service udp should be -mode udp.

The option flag for specifying the port mapping is –publish or -p, not -p. For example, -p 53:53 should be –publish 53:53.

The correct command for creating a swarm service that only listens on port 53 using the UDP protocol is:

docker service create –name dns-cache –publish 53:53/udp dns-cache

This command will create a service called dns-cache that uses the dns-cache image and exposes port 53 on both the host and the container using the UDP protocol.

Reference: : [docker service create | Docker Documentation] : [Publish ports for services | Docker Documentation]

Latest DCA Dumps Valid Version with 55 Q&As

Latest And Valid Q&A | Instant Download | Once Fail, Full Refund

Exit mobile version