首页 > 解决方案 > PC重新启动后,流浪机器无法启动。它显示端口冲突

问题描述

更新: 主机 PC 重新启动后,vagrant up 显示任何端口上的端口冲突

我的流浪机器无法启动。通常它工作正常,但今天我重新启动我的电脑后,流浪机器不再启动。我没有更改 Vagrantfile。它说关于端口冲突。如果我删除 redis 的 6379 设置,那么它会显示端口 1080 等等。就像所有的端口都有碰撞。如果我尝试通过 VMware 运行 macine - 然后它启动正常,但我无法通过 ssh 连接到它,因为它没有 Vagrantfile 中定义的设置...

这是日志:

$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Checking if box 'ubuntu/trusty64' is up to date...
==> default: There was a problem while downloading the metadata for your box
==> default: to check for updates. This is not an error, since it is usually due
==> default: to temporary network problems. This is just a warning. The problem
==> default: encountered was:
==> default:
==> default: The requested URL returned error: 404
==> default:
==> default: If you want to check for box updates, verify your network connectio                                                                                                                                                                                               n
==> default: is valid and try again.
==> default: Fixed port collision for 6379 => 6379. Now on port 2250.
Vagrant found a port collision for the specified port and virtual machine.
While this port was marked to be auto-corrected, the ports in the
auto-correction range are all also used.

VM: default
Forwarded port: 1080 => 1080

这是我的流浪文件:

Vagrant.configure("2") do |config|
  config.vm.box = "ubuntu/trusty64"

  forward_port = ->(guest, host = guest) do
    config.vm.network :forwarded_port,
      guest: guest,
      host: host,
      auto_correct: true
  end

  config.vm.synced_folder "sites/", "/var/www"
  config.vm.synced_folder ".", "/vagrant", disabled: true


  forward_port[6379]      # redis
  forward_port[1080]      # mailcatcher
  forward_port[3306]      # mysql
  forward_port[80, 8080]  # nginx/apache

  config.vm.provision :puppet do |puppet|
    puppet.manifests_path = "manifests"
    puppet.manifest_file = "default.pp"
  end

  config.vm.network :private_network, ip: "33.33.33.10"

  config.ssh.username = "vagrant"
  config.ssh.password = "vagrant"
end

标签: vagrant

解决方案


推荐阅读