兩臺機器上分別建立docker-compose.yml
然後執行docker-compose up -d

version: '2'
services:
        nsqlookupd:
                image: nsqio/nsq
                command: /nsqlookupd
                ports:
                        - "192.168.174.130:4160:4160"
                        - "192.168.174.130:4161:4161"
        nsqd:
                image: nsqio/nsq
                command: /nsqd --broadcast-address=192.168.174.130 --lookupd-tcp-address=192.168.174.130:4160
                depends_on:
                        - nsqlookupd
                ports:
                        - "192.168.174.130:4150:4150"
                        - "192.168.174.130:4151:4151"
        nsqadmin:
                image: nsqio/nsq
                command: /nsqadmin --lookupd-http-address=192.168.174.130:4161
                depends_on:
                        - nsqlookupd
                ports:
                        - "192.168.174.130:4171:4171"
version: '2'
services:
        nsqd:
                image: nsqio/nsq
                command: /nsqd --broadcast-address=192.168.174.131 --lookupd-tcp-address=192.168.174.130:4160
                ports:
                        - "192.168.174.131:4150:4150"
                        - "192.168.174.131:4151:4151"
.