How can I remotely connect to docker swarm?

前端 未结 4 798
谎友^
谎友^ 2020-12-31 07:30

Is it possible to execute commands on a docker swarm cluster hosted in cloud from my local mac? If yes, how?

I want to execute command such as following on docker sw

4条回答
  •  伪装坚强ぢ
    2020-12-31 08:22

    Answer to the question can be found here.

    What one needs to do for ubuntu machine is define daemon.json file at path /etc/docker with following content:

      {
        "hosts": ["tcp://0.0.0.0:2375", "unix:///var/run/docker.sock"]
      }
    

    The above configuration is unsecured and shouldn't be used if server is publicly hosted.

    For secured connection use following config:

    {
      "tls": true,
      "tlscert": "/var/docker/server.pem",
      "tlskey": "/var/docker/serverkey.pem",
      "hosts": ["tcp://x.x.x.y:2376", "unix:///var/run/docker.sock"]
    }
    

    Details for generating certificate can be found here as mentioned by @BMitch.

提交回复
热议问题