File tree Expand file tree Collapse file tree
docs/reference/commandline Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -370,13 +370,16 @@ access to the network.
370370When you create a service and pass the --network flag to attach the service to
371371the overlay network:
372372
373+ ``` bash
373374$ docker service create \
374375 --replicas 3 \
375376 --network my-network \
376377 --name my-web \
377378 nginx
378379
379380716thylsndqma81j6kkkb5aus
381+ ```
382+
380383The swarm extends my-network to each node running the service.
381384
382385Containers on the same network can access each other using
@@ -388,13 +391,13 @@ You can publish service ports to make them available externally to the swarm
388391using the ` --publish ` flag:
389392
390393``` bash
391- docker service create --publish < TARGET-PORT> :< SERVICE-PORT> nginx
394+ $ docker service create --publish < TARGET-PORT> :< SERVICE-PORT> nginx
392395```
393396
394397For example:
395398
396399``` bash
397- docker service create --name my_web --replicas 3 --publish 8080:80 nginx
400+ $ docker service create --name my_web --replicas 3 --publish 8080:80 nginx
398401```
399402
400403When you publish a service port, the swarm routing mesh makes the service
You can’t perform that action at this time.
0 commit comments