docker exec -it n1 bash apt-get update apt-get install keepalived apt-get install vim 再次之前要配置VIP虚拟IP docker network create --subnet=192.168.99.151/16 net1 docker network ls 这里还要设置下vim 无法粘贴问题 vi /etc/keepalived/keepalived.conf 启动keepalived service keepalived start docker run -it -d --name n2 -v /home/n2/nginx.conf:/etc/nginx/nginx.conf --net=host --privileged nginx 重复上面步骤