ExamGecko
Question list
Search
Search

List of questions

Search

Related questions











Question 4 - DCA discussion

Report
Export

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'

A.

Yes

Answers
A.

Yes

B.

No

Answers
B.

No

Suggested answer: B

Explanation:

= The command 'docker service create -name dns-cache -p 53:53/udp dns-cache' is not correct and will not create a swarm service that only listens on port 53 using the UDP protocol. There are two errors in the command:

The option-nameshould be--namewith two dashes, otherwise it will be interpreted as a short option-nfollowed by an argumentame1.

The option-por--publishwill publish the service port to the host port, which means the service will be reachable from outside the swarm2.To create a service that only listens on the internal network, you need to use the--publish-addoption with themode=ingressflag3.

The correct command should be:

docker service create --name dns-cache --publish-add mode=ingress,target=53,published=53,protocol=udp dns-cache

docker service create | Docker Docs

Publish ports on the host | Docker Docs

Publish a port for a service | Docker Docs

asked 08/11/2024
Sumit Dhar
47 questions
User
Your answer:
0 comments
Sorted by

Leave a comment first