[英]How to see Nginx default page using vagrant docker provider?
我嘗試使用像這樣的無聊的docker提供程序來運行我的Nginx服務器:
vagrant up
Vagrantfile
說明是:
# Specify Vagrant version and Vagrant API version
Vagrant.require_version ">= 1.6.0"
VAGRANTFILE_API_VERSION = "2"
ENV['VAGRANT_DEFAULT_PROVIDER'] = 'docker'
# Create and configure the Docker container(s)
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.network "private_network", ip: "192.168.66.66"
config.vm.provider "docker" do |docker|
docker.name = 'nginx-container'
docker.image = "nginx:latest"
docker.ports = ['80:80', '443:443']
end
end
如果我用vagrant status
檢查無業vagrant status
我會得到:
Current machine states:
default running (docker)
The container is created and running. You can stop it using
`vagrant halt`, see logs with `vagrant docker-logs`, and
kill/destroy it with `vagrant destroy`.
當我嘗試獲取http://192.168.66.66/
頁面時,出現ERR_CONNECTION_TIMED_OUT
且頁面未加載。 為什么我看不到Nginx默認網頁?
在控制台中vagrant up
期間的日志為:
==> default: Docker host is required. One will be created if necessary...
default: Docker host VM is already ready.
==> default: Syncing folders to the host VM...
default: Installing rsync to the VM...
default: Rsyncing folder: /Users/victor/www/symfony/ => /var/lib/docker/docker_1430638235_29519
==> default: Warning: When using a remote Docker host, forwarded ports will NOT be
==> default: immediately available on your machine. They will still be forwarded on
==> default: the remote machine, however, so if you have a way to access the remote
==> default: machine, then you should be able to access those ports there. This is
==> default: not an error, it is only an informational message.
==> default: Creating the container...
default: Name: nginx-container
default: Image: nginx:latest
default: Volume: /var/lib/docker/docker_1430638235_29519:/vagrant
default: Port: 80:80
default: Port: 443:443
default:
default: Container created: b798ea3309612fb2
==> default: Starting container...
==> default: Provisioners will not be run since container doesn't support SSH.
這已經有幾個月了,但是為了其他可能會落在這里的人,我還是會回答:
使用docker ps
查看您的圖像標識符,應為'b798ea3309612fb2'
然后執行:
docker inspect b798ea3309612fb2 | grep IPAddress
因此,您將確認IP地址。
由於要公開端口,因此應該在REAL(用於Vagrant的任何容器)IP中看到它們。 確保沒有防火牆阻止它們。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.