Wednesday, 21 August 2019

What is docker service(create,ls,logs) in docker swarm by Raj Gupta


-------------------------------------------------------------------------------------------------------
after running below command on Master it will create a container on Worker01(172.31.88.27) then  it will start pining to it

[root@ip-172-31-83-166 ~]# docker container run -it alpine ping 172.31.88.27
Unable to find image 'alpine:latest' locally
latest: Pulling from library/alpine
9d48c3bd43c5: Pull complete
Digest: sha256:72c42ed48c3a2db31b7dafe17d275b634664a708d901ec9fd57b1529280f01fb
Status: Downloaded newer image for alpine:latest
PING 172.31.88.27 (172.31.88.27): 56 data bytes
64 bytes from 172.31.88.27: seq=0 ttl=254 time=0.942 ms
64 bytes from 172.31.88.27: seq=1 ttl=254 time=0.644 ms
64 bytes from 172.31.88.27: seq=2 ttl=254 time=0.572 ms
64 bytes from 172.31.88.27: seq=3 ttl=254 time=0.635 ms
64 bytes from 172.31.88.27: seq=4 ttl=254 time=0.616 ms
^Z64 bytes from 172.31.88.27: seq=5 ttl=254 time=0.708 ms
64 bytes from 172.31.88.27: seq=6 ttl=254 time=0.716 ms
64 bytes from 172.31.88.27: seq=7 ttl=254 time=0.765 ms
64 bytes from 172.31.88.27: seq=8 ttl=254 time=0.645 ms
64 bytes from 172.31.88.27: seq=9 ttl=254 time=0.629 ms
^C
--- 172.31.88.27 ping statistics ---
10 packets transmitted, 10 packets received, 0% packet loss
round-trip min/avg/max = 0.572/0.687/0.942 ms
[root@ip-172-31-83-166 ~]#


---------------------------------------------------------------------------------------

[root@ip-172-31-83-166 ~]# docker service --help

Usage:  docker service COMMAND

Manage services

Commands:
  create      Create a new service
  inspect     Display detailed information on one or more services
  logs        Fetch the logs of a service or task
  ls          List services
  ps          List the tasks of one or more services
  rm          Remove one or more services
  rollback    Revert changes to a service's configuration
  scale       Scale one or multiple replicated services
  update      Update a service

Run 'docker service COMMAND --help' for more information on a command.
[root@ip-172-31-83-166 ~]#

-------------------------------------------------------------------------------------------------------

This is also create a container on worker and run the ping command

To create the docker service 

[root@ip-172-31-83-166 ~]# docker service create alpine ping 172.31.81.43

docker service ls will list the created services

[root@ip-172-31-83-166 ~]# docker service ls
ID                  NAME                 MODE                REPLICAS            IMAGE               PORTS
8ybsu9bgen5e        confident_poincare   replicated          1/1                 alpine:latest
lc7l8xvo9a0o        nifty_albattani      replicated          1/1                 alpine:latest


To see the detail of docker service 

[root@ip-172-31-83-166 ~]# docker service inspect 8ybsu9bgen5e


To check the logs of service 

[root@ip-172-31-83-166 ~]# docker service logs 8ybsu9bgen5e




1 comment:

  1. Hello everyone , here’s your opportunity for you to achieve your dreams of being a multi million dollar rich through trading , I once loss all I got through trading but was fortunate to come across a woman with great virtue and selfless heart (Mary ) i was introduce to her masterclass strategy while searching online which has revived me of all my losses and made me gain more and more . With her unique strategy you are entitled to daily signals and instant withdraw ,be rest assured of getting a refund of all your loss investment with any platform that has denied you in one way or the other in getting your money . Mrs Mary masterclass strategy is simply the best for beginners and those that are finding it difficult to succeed through trading she’ll help you with just a simple step . Email her ( maryshea03 @ Gmail .com) WhatsApp +1 562 384 7738 . Remember this is absolutely free!!!

    ReplyDelete