我想在Windows浏览器上运行Apache sling Web服务器,但是问题在于我需要运行sling服务器本身 在本身正在使用vagrant在linux虚拟机上运行的docker容器上。基本上是Windows-> CentOS-> Sling Docker容器,我想要 将docker容器上运行的Web服务器端口公开给Windows上的chrome浏览器。以下是我的vagrantfile,希望对您有所帮助。
unless Vagrant.has_plugin?("vagrant-docker-compose")
system("vagrant plugin install vagrant-docker-compose")
puts "Dependencies installed, please try the command again."
exit
end
Vagrant.configure("2") do |config|
config.vm.box = "centos/7"
config.vm.network "forwarded_port", guest: 5432, host: 5432, host_ip:
"127.0.0.1"
config.vm.network "forwarded_port", guest: 22, host: 2233, id: "ssh"
config.vm.network "forwarded_port", guest: 80, host: 4000, host_ip:
"127.0.0.1"
config.vm.network "forwarded_port", guest: 8080, host: 8080, host_ip:
"127.0.0.1"
config.vm.network "forwarded_port", guest: 8000, host: 8000, host_ip:
"127.0.0.1"
config.vm.synced_folder "../../sling-org-apache-sling-starter-10/target",
"/opt/sling/sling", type: "rsync"
config.vm.provision :docker
config.vm.provision :docker_compose
config.vm.provision "docker" do |d|
d.run "apache/sling"
end
end