docker-archive / classicswarm

Swarm Classic: a container clustering system. Not to be confused with Docker Swarm which is at https://github.com/docker/swarmkit
Apache License 2.0
5.76k stars 1.08k forks source link

What i have to do after configure and start Engine? #2482

Closed khoi-thinh closed 4 years ago

khoi-thinh commented 7 years ago

Hello everyone, I followed the tutorial on Docker's homepage on how to Build a Swarm cluster for production. I was kind of confused about what to do next after step 3. Configure and start Engine so it listens for Swarm nodes on port 2375. After running the command line at step 3, my terminal was like this forever: `INFO[0000] Graph migration to content-addressability took 0.00 seconds WARN[0000] mountpoint for pids not found INFO[0000] Loading containers: start. WARN[0000] Running modprobe bridge br_netfilter failed with message: modprobe: WARNING: Module br_netfilter not found. insmod /lib/modules/3.10.0-327.10.1.el7.x86_64/kernel/net/llc/llc.ko insmod /lib/modules/3.10.0-327.10.1.el7.x86_64/kernel/net/802/stp.ko insmod /lib/modules/3.10.0-327.10.1.el7.x86_64/kernel/net/bridge/bridge.ko , error: exit status 1 INFO[0000] Firewalld running: false INFO[0000] Default bridge (docker0) is assigned with an IP address 172.17.0.0/16. Daemon option --bip can be used to set a preferred IP address

INFO[0000] Loading containers: done. INFO[0000] Daemon has completed initialization INFO[0000] Docker daemon commit=23cf638 graphdriver=devicemapper version=1.12.1 INFO[0000] API listen on /var/run/docker.sock INFO[0000] API listen on [::]:2375`

If this the step to start Engine, how could i go ahead to verify Docker was installed correctly with step 4. Do i have to hit Ctrl + D to exit out of that. In that case, here's the output: ^CINFO[0133] Processing signal 'interrupt' INFO[0133] stopping containerd after receiving terminated

Not sure what to do here? Someone please clarify this.

One more question: Here's output of ifconfig on my manager0 [root@ip-10-0-2-39 ~]# ifconfig docker0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500 inet 172.17.0.1 netmask 255.255.0.0 broadcast 0.0.0.0 inet6 fe80::42:44ff:fe4b:4889 prefixlen 64 scopeid 0x20 ether 02:42:44:4b:48:89 txqueuelen 0 (Ethernet) RX packets 1 bytes 76 (76.0 B) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 3 bytes 258 (258.0 B) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 9001 inet 10.0.2.39 netmask 255.255.255.0 broadcast 10.0.2.255 inet6 fe80::a7:9bff:fe39:2473 prefixlen 64 scopeid 0x20 ether 02:a7:9b:39:24:73 txqueuelen 1000 (Ethernet) RX packets 108165 bytes 158396239 (151.0 MiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 51458 bytes 3785036 (3.6 MiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536 inet 127.0.0.1 netmask 255.0.0.0 inet6 ::1 prefixlen 128 scopeid 0x10 loop txqueuelen 0 (Local Loopback) RX packets 70 bytes 5984 (5.8 KiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 70 bytes 5984 (5.8 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

And here's the output of ifconfig on consul0 [root@ip-10-0-2-67 ~]# ifconfig docker0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 172.17.0.1 netmask 255.255.0.0 broadcast 0.0.0.0 inet6 fe80::42:7aff:fea2:9eab prefixlen 64 scopeid 0x20 ether 02:42:7a:a2:9e:ab txqueuelen 0 (Ethernet) RX packets 9 bytes 612 (612.0 B) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 3 bytes 258 (258.0 B) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 9001 inet 10.0.2.67 netmask 255.255.255.0 broadcast 10.0.2.255 inet6 fe80::40:48ff:fef8:a545 prefixlen 64 scopeid 0x20 ether 02:40:48:f8:a5:45 txqueuelen 1000 (Ethernet) RX packets 126845 bytes 185578011 (176.9 MiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 67783 bytes 5112251 (4.8 MiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536 inet 127.0.0.1 netmask 255.0.0.0 inet6 ::1 prefixlen 128 scopeid 0x10 loop txqueuelen 0 (Local Loopback) RX packets 70 bytes 5984 (5.8 KiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 70 bytes 5984 (5.8 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

veth94209cd: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet6 fe80::c842:a6ff:fe36:cabb prefixlen 64 scopeid 0x20 ether ca:42:a6:36:ca:bb txqueuelen 0 (Ethernet) RX packets 8 bytes 648 (648.0 B) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 8 bytes 648 (648.0 B) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

But then [root@ip-10-0-2-39 ~]# docker run -d -p 4000:4000 swarm manage -H :4000 --replication --advertise <10.0.2.39>:4000 consul://<10.0.2.67>:8500 bash: 10.0.2.39: No such file or directory

I did something wrong? This docker swarm seems way more complicated than Docker swarm mode :(

michelvocks commented 7 years ago

Hello @thinhduckhoi and welcome to docker swarm. :wink:

I was kind of confused about what to do next after step 3. Configure and start Engine so it listens for Swarm nodes on port 2375.

This might be a bit confusing by the docs. You actually started the docker daemon in foreground which is useful when you want to debug the daemon but not when you just want to run it. The solution is to add the listen ip:port option e.g. -H tcp://0.0.0.0:2375 to the daemon configuration. Here is the documentation how you can do that for your OS: https://docs.docker.com/engine/admin/#/configuring-docker

But then [root@ip-10-0-2-39 ~]# docker run -d -p 4000:4000 swarm manage -H :4000 --replication --advertise <10.0.2.39>:4000 consul://<10.0.2.67>:8500 bash: 10.0.2.39: No such file or directory

You have to remove the "<>" from the advertise ip address and from the consul address.

By the way. I recommend to have a look at docker machine which does mostly all the configuration for you and more. We use it to provision all our hosts and setup all our docker swarm clusters. You can also use it in combination with the generic driver to setup your environment with existing servers.

khoi-thinh commented 7 years ago

Thank you for your comment. Ah, i found out the reason why it was running ceaseless. I used CentOS 7 for the test while the document said that During Step 1: Choose an Amazon Machine Image (AMI), pick the Amazon Linux AMI. So started all over again, but this time i got another new error: [root@ip-10-0-2-143 ~]# sudo docker daemon -H tcp://0.0.0.0:2375 -H unix:///var/run/docker.sock WARN[0000] /!\ DON'T BIND ON ANY IP ADDRESS WITHOUT setting -tlsverify IF YOU DON'T KNOW WHAT YOU'RE DOING /!\ INFO[0000] previous instance of containerd still alive (8212) WARN[0000] devmapper: Usage of loopback devices is strongly discouraged for production use. Please use --storage-opt dm.thinpooldev or use man docker to refer to dm.thinpooldev section. WARN[0000] devmapper: Base device already exists and has filesystem xfs on it. User specified filesystem will be ignored. INFO[0000] [graphdriver] using prior storage driver "devicemapper" INFO[0000] Graph migration to content-addressability took 0.00 seconds INFO[0000] Firewalld running: false INFO[0000] Default bridge (docker0) is assigned with an IP address 172.17.0.0/16. Daemon option --bip can be used to set a preferred IP address WARN[0000] Your kernel does not support cgroup memory limit WARN[0000] Unable to find cpu cgroup in mounts WARN[0000] Unable to find blkio cgroup in mounts WARN[0000] Unable to find cpuset cgroup in mounts WARN[0000] mountpoint for pids not found FATA[0000] Error starting daemon: Devices cgroup isn't mounted

After searching google for a while, someone said i need to start the docker service. I started it and run the command again, but it still didn't work. FATA[0000] Error starting daemon: pid file found, ensure docker is not running or delete /var/run/docker.pid

By the way, i want to ask you a little about the 2nd usecase of docker-machine. "I want to provision Docker hosts on remote systems" For example, i have 4 instance EC2 on AWS. Let's call them manager, node0, node1 and node2. All of them installed with CentOS 7. I want to use Docker to create wordpress site on manager instance and then deploy it to node0, node1 and node2. Is that possible? Do i have to use docker-machine or in just need to install docker-engine with docker-swarm mode?