你好我用以下方式创建了群集
在我的工作站上:
$docker pull swarm
$docker run --rm swarm create
在另一个泊坞主机上
docker run -d swarm join --addr=nodeIP:2375token://cluster_id_from_step_2
返回工作站
docker run -d -p 8333:2375 swarm manage token://cluster_id
如果我通过在工作站上运行以下命令列出在该群集上运行的节点,我会看到nodeIP 但是如果我运行以下命令
sudo docker -H tcp://workstationIP:8333 info
Containers: 0
Images: 0
Role: primary
Strategy: spread
Filters: affinity, health, constraint, port, dependency
Nodes: 0
CPUs: 0
Total Memory: 0 B
为什么我不在节点中看到节点IP?
注意:此设置在基于virtualBox的vagrant的专用网络中运行
vagrantfile
Vagrant.configure(2) do |config|
config.vm.box = "phusion/ubuntu-14.04-amd64"
config.vm.hostname = "docker-test-machine"
config.vm.network "private_network", type: "dhcp"
config.vm.network "forwarded_port", guest: 80, host: 80
config.ssh.forward_agent = true
config.vm.synced_folder "H:\\home_folder", "/home_folder"
config.vm.provider "virtualbox" do |vb|
vb.memory = 2048
vb.cpus = 4
end
config.vm.provision "shell", inline: <<-SCRIPT
## install docker
if ! type docker >/dev/null; then
echo "installing Docker"
curl -sL https://get.docker.io/ | sh
curl -sL https://raw.githubusercontent.com/dotcloud/docker/master/contrib/completion/bash/docker > /etc/bash_completion.d/docker
adduser vagrant docker
else
echo "upgrading Docker"
apt-get update
apt-get -y install lxc-docker
fi
SCRIPT
end
答案 0 :(得分:0)
你做完之后:
docker run -d -p 8333:2375 swarm manage token://cluster_id
...你的群体管理员在8333
端口而不是2375
;您需要使用以下命令查询swarm管理器:
docker -H tcp://workstationIP:8333 info