I'm trying to create 3 zookeeper services in my docker swarm. However only managed to create 2 of the 3 containers:
docker ps -a returns:
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
2c883f9148ff hyperledger/fabric-zookeeper:latest "/docker-entrypoint.…" 2 minutes ago Up 2 minutes 2181/tcp, 2888/tcp, 3888/tcp fabric_zookeeper1.1.td4wpq2t9uj5yjnw0q76gsqi0
068ef5d9075b hyperledger/fabric-zookeeper:latest "/docker-entrypoint.…" 2 minutes ago Up 2 minutes 2181/tcp, 2888/tcp, 3888/tcp fabric_zookeeper2.1.u3zr2o8lifcncjo6g2u2yqhwu
docker network ls return:
NETWORK ID NAME DRIVER SCOPE
0e17f2cd7e8d bridge bridge local
4f78c376719f docker_gwbridge bridge local
djds6rgg0pqc fabric overlay swarm
o1es27fz05i1 fabric_net overlay swarm
2f99d3b30b86 host host local
ls05jfjuekg0 ingress overlay swarm
e7d8a3ff8bb2 net_blockcord bridge local
42ec3d9a4f1b none null local
docker network inspect fabric_net return:
[
{
"Name": "fabric_net",
"Id": "o1es27fz05i1g9cjrq5nvv0ok",
"Created": "2018-10-26T07:41:49.436040523Z",
"Scope": "swarm",
"Driver": "overlay",
"EnableIPv6": false,
"IPAM": {
"Driver": "default",
"Options": null,
"Config": [
{
"Subnet": "10.0.6.0/24",
"Gateway": "10.0.6.1"
}
]
},
"Internal": false,
"Attachable": false,
"Ingress": false,
"ConfigFrom": {
"Network": ""
},
"ConfigOnly": false,
"Containers": {
"068ef5d9075bc9c61b313b97cfbb36189401bc4eb72258b4346f659add5b3a0a": {
"Name": "fabric_zookeeper2.1.u3zr2o8lifcncjo6g2u2yqhwu",
"EndpointID": "3274a8bc693c742a0acedd786174a1c7ed4c2843cd28a6ff9140a2e977059657",
"MacAddress": "02:42:0a:00:06:11",
"IPv4Address": "10.0.6.17/24",
"IPv6Address": ""
},
"2c883f9148ff3b53228e8d02a8bd60db754cd2677155307e5db31f426e356223": {
"Name": "fabric_zookeeper1.1.td4wpq2t9uj5yjnw0q76gsqi0",
"EndpointID": "f58c3c303a6f2fe22ba410e0881f67ce002cbfc5e0afe9cd1104f7f11e2c6ecf",
"MacAddress": "02:42:0a:00:06:15",
"IPv4Address": "10.0.6.21/24",
"IPv6Address": ""
},
"lb-fabric_net": {
"Name": "fabric_net-endpoint",
"EndpointID": "d70a81ad2631c3b76feac7484599e0715c9b901d2ed72153a38105b236b4c882",
"MacAddress": "02:42:0a:00:06:02",
"IPv4Address": "10.0.6.2/24",
"IPv6Address": ""
}
},
"Options": {
"com.docker.network.driver.overlay.vxlanid_list": "4103"
},
"Labels": {
"com.docker.stack.namespace": "fabric"
},
"Peers": [
{
"Name": "a2beaca62ca3",
"IP": "10.0.0.5"
},
{
"Name": "fa12393e1d65",
"IP": "137.116.149.79"
}
]
}
]
With my container showing only 2 of my 3 zookeepers
I first create an overlay network
docker network create --attachable --driver overlay fabric
and ran the below docker compose file using command:
docker stack deploy -c docker-compose-zookeeper.yaml fabric
docker-compose-zookeeper.yaml
# Copyright IBM Corp. All Rights Reserved.
#
# SPDX-License-Identifier: Apache-2.0
#
version: '3'
networks:
net:
services:
zookeeper0:
hostname: zookeeper0.example.com
image: hyperledger/fabric-zookeeper
ports:
- 2181
- 2888
- 3888
environment:
- ZOO_MY_ID=1
- ZOO_SERVERS=server.1=0.0.0.0:2888:3888 server.2=zookeeper1:2888:3888 server.3=zookeeper2:2888:3888
networks:
- net
zookeeper1:
hostname: zookeeper1.example.com
image: hyperledger/fabric-zookeeper
ports:
- 2181
- 2888
- 3888
environment:
- ZOO_MY_ID=2
- ZOO_SERVERS=server.1=zookeeper0:2888:3888 server.2=0.0.0.0:2888:3888 server.3=zookeeper2:2888:3888
networks:
- net
zookeeper2:
hostname: zookeeper2.example.com
image: hyperledger/fabric-zookeeper
ports:
- 2181
- 2888
- 3888
environment:
- ZOO_MY_ID=3
- ZOO_SERVERS=server.1=zookeeper0:2888:3888 server.2=zookeeper1:2888:3888 server.3=0.0.0.0:2888:3888
networks:
- net
docker info:
Containers: 2
Running: 2
Paused: 0
Stopped: 0
Images: 15
Server Version: 18.06.1-ce
Storage Driver: overlay2
Backing Filesystem: extfs
Supports d_type: true
Native Overlay Diff: false
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
Volume: local
Network: bridge host macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file logentries splunk syslog
Swarm: active
NodeID: x8mooygnt8mzruof5c5d3p0vp
Is Manager: true
ClusterID: vmqqjuwztz3sraag3e8dgpqbl
Managers: 2
Nodes: 2
Orchestration:
Task History Retention Limit: 5
Raft:
Snapshot Interval: 10000
Number of Old Snapshots to Retain: 0
Heartbeat Tick: 1
Election Tick: 10
Dispatcher:
Heartbeat Period: 5 seconds
CA Configuration:
Expiry Duration: 3 months
Force Rotate: 0
Autolock Managers: false
Root Rotation In Progress: false
Node Address: 10.0.0.5
Manager Addresses:
137.116.149.79:2377
168.63.239.163:2377
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 468a545b9edcd5932818eb9de8e72413e616e86e
runc version: 69663f0bd4b60df09991c08812a60108003fa340
init version: fec3683
Security Options:
apparmor
seccomp
Profile: default
Kernel Version: 4.15.0-1023-azure
Operating System: Ubuntu 16.04.5 LTS
OSType: linux
Architecture: x86_64
CPUs: 2
Total Memory: 3.853GiB
Name: blockcord-staging2
ID: UT5F:4ZFW:4PRT:LGFS:JIV4:3YAD:DK5I:BIYL:FU6P:ZFEB:3OD3:U5EX
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
Labels:
Experimental: false
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: false
WARNING: No swap limit support
Found out that the container was created in my other nodes. But my container wasnt able to resolve address of the service
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.