Docker Swarm 入门示例3: 部署服务到swarm

  1. 打开manager1服务器 shell

  2. 创建服务

    命令:docker service create --replicas 1 --name helloworld alpine ping baidu.com

    $ docker service create --replicas 1 --name helloworld alpine ping baidu.com
    fqfl3lzv87dikpys0cuek7u72
    Since --detach=false was not specified, tasks will be created in the background.
    In a future release, --detach=false will become the default.
    
    
  3. 查看运行的服务列表 命令: docker service ls

    $ docker service ls
    ID                  NAME                MODE                REPLICAS            IMAGE               PORTS
    fqfl3lzv87di        helloworld          replicated          1/1                 alpine:latest
    
    

猜你喜欢

转载自my.oschina.net/u/915811/blog/1593846