我是Docker的新手,所以我决定通过tutorial for Windows。我被困在"探索应用程序"我运行Dockerized nginx Web服务器的段。当我尝试在Chrome中打开网络服务器时,我收到403 Forbidden Error:
我看过StackOverflow并搜索了这个问题,涉及这个问题的每个问题都是使用我在教程中看不到的组件来解决的。我的目标是获得#34;欢迎来到nginx!"我在网络浏览器中输入localhost
时的页面。
我使用的是Windows 10企业版,Docker版本为18.03.0-ce,版本为0520e24。
编辑:根据评论中的一些建议,我在这里打印了配置文件。我不知道配置错误的位置。
[
{
"Id": "67de198556e7da0e9b71e57650246d08506b4c49968ba1c87627513ffee41a79",
"Created": "2018-04-07T20:29:48.9119428Z",
"Path": "nginx",
"Args": [
"-g",
"daemon off;"
],
"State": {
"Status": "running",
"Running": true,
"Paused": false,
"Restarting": false,
"OOMKilled": false,
"Dead": false,
"Pid": 3537,
"ExitCode": 0,
"Error": "",
"StartedAt": "2018-04-07T20:29:49.6956743Z",
"FinishedAt": "0001-01-01T00:00:00Z"
},
"Image": "sha256:c5c4e8fa2cf7d87545ed017b60a4b71e047e26c4ebc71eb1709d9e5289f9176f",
"ResolvConfPath": "/var/lib/docker/containers/67de198556e7da0e9b71e57650246d08506b4c49968ba1c87627513ffee41a79/resolv.conf",
"HostnamePath": "/var/lib/docker/containers/67de198556e7da0e9b71e57650246d08506b4c49968ba1c87627513ffee41a79/hostname",
"HostsPath": "/var/lib/docker/containers/67de198556e7da0e9b71e57650246d08506b4c49968ba1c87627513ffee41a79/hosts",
"LogPath": "/var/lib/docker/containers/67de198556e7da0e9b71e57650246d08506b4c49968ba1c87627513ffee41a79/67de198556e7da0e9b71e57650246d08506b4c49968ba1c87627513ffee41a79-json.log",
"Name": "/webserver",
"RestartCount": 0,
"Driver": "overlay2",
"Platform": "linux",
"MountLabel": "",
"ProcessLabel": "",
"AppArmorProfile": "",
"ExecIDs": null,
"HostConfig": {
"Binds": null,
"ContainerIDFile": "",
"LogConfig": {
"Type": "json-file",
"Config": {}
},
"NetworkMode": "default",
"PortBindings": {
"80/tcp": [
{
"HostIp": "",
"HostPort": "80"
}
]
},
"RestartPolicy": {
"Name": "no",
"MaximumRetryCount": 0
},
"AutoRemove": false,
"VolumeDriver": "",
"VolumesFrom": null,
"CapAdd": null,
"CapDrop": null,
"Dns": [],
"DnsOptions": [],
"DnsSearch": [],
"ExtraHosts": null,
"GroupAdd": null,
"IpcMode": "shareable",
"Cgroup": "",
"Links": null,
"OomScoreAdj": 0,
"PidMode": "",
"Privileged": false,
"PublishAllPorts": false,
"ReadonlyRootfs": false,
"SecurityOpt": null,
"UTSMode": "",
"UsernsMode": "",
"ShmSize": 67108864,
"Runtime": "runc",
"ConsoleSize": [
50,
250
],
"Isolation": "",
"CpuShares": 0,
"Memory": 0,
"NanoCpus": 0,
"CgroupParent": "",
"BlkioWeight": 0,
"BlkioWeightDevice": [],
"BlkioDeviceReadBps": null,
"BlkioDeviceWriteBps": null,
"BlkioDeviceReadIOps": null,
"BlkioDeviceWriteIOps": null,
"CpuPeriod": 0,
"CpuQuota": 0,
"CpuRealtimePeriod": 0,
"CpuRealtimeRuntime": 0,
"CpusetCpus": "",
"CpusetMems": "",
"Devices": [],
"DeviceCgroupRules": null,
"DiskQuota": 0,
"KernelMemory": 0,
"MemoryReservation": 0,
"MemorySwap": 0,
"MemorySwappiness": null,
"OomKillDisable": false,
"PidsLimit": 0,
"Ulimits": null,
"CpuCount": 0,
"CpuPercent": 0,
"IOMaximumIOps": 0,
"IOMaximumBandwidth": 0
},
"GraphDriver": {
"Data": {
"LowerDir": "/var/lib/docker/overlay2/c273414203bb1d24f7fbcae3d0e59cc5862177ebd8f76b36932e34906a62451e-init/diff:/var/lib/docker/overlay2/6c92d8da4b6dc602aec458c26ea89f896e8f1419669fde38695b4a8536e1b5eb/diff:/var/lib/docker/overlay2/ba798be7f037f7a409573831d1c97c8ce6364ee5d211203d53ffae65c31356ae/diff:/var/lib/docker/overlay2/e64dbbe96402a9a713d35ad3496b47aba1d9f71b158833ea2826f9bafc0c6060/diff",
"MergedDir": "/var/lib/docker/overlay2/c273414203bb1d24f7fbcae3d0e59cc5862177ebd8f76b36932e34906a62451e/merged",
"UpperDir": "/var/lib/docker/overlay2/c273414203bb1d24f7fbcae3d0e59cc5862177ebd8f76b36932e34906a62451e/diff",
"WorkDir": "/var/lib/docker/overlay2/c273414203bb1d24f7fbcae3d0e59cc5862177ebd8f76b36932e34906a62451e/work"
},
"Name": "overlay2"
},
"Mounts": [],
"Config": {
"Hostname": "67de198556e7",
"Domainname": "",
"User": "",
"AttachStdin": false,
"AttachStdout": false,
"AttachStderr": false,
"ExposedPorts": {
"80/tcp": {}
},
"Tty": false,
"OpenStdin": false,
"StdinOnce": false,
"Env": [
"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
"NGINX_VERSION=1.13.11-1~stretch",
"NJS_VERSION=1.13.11.0.2.0-1~stretch"
],
"Cmd": [
"nginx",
"-g",
"daemon off;"
],
"ArgsEscaped": true,
"Image": "nginx",
"Volumes": null,
"WorkingDir": "",
"Entrypoint": null,
"OnBuild": null,
"Labels": {
"maintainer": "NGINX Docker Maintainers <docker-maint@nginx.com>"
},
"StopSignal": "SIGTERM"
},
"NetworkSettings": {
"Bridge": "",
"SandboxID": "8441b997d10c187f4f8b1f61e12b44ed7f8b9aff30c19277ef0725deb0266a99",
"HairpinMode": false,
"LinkLocalIPv6Address": "",
"LinkLocalIPv6PrefixLen": 0,
"Ports": {
"80/tcp": [
{
"HostIp": "0.0.0.0",
"HostPort": "80"
}
]
},
"SandboxKey": "/var/run/docker/netns/8441b997d10c",
"SecondaryIPAddresses": null,
"SecondaryIPv6Addresses": null,
"EndpointID": "1bfa563ee831522a547b1977a02d068d576e25427d3bc48c4b27ec76775858fc",
"Gateway": "172.17.0.1",
"GlobalIPv6Address": "",
"GlobalIPv6PrefixLen": 0,
"IPAddress": "172.17.0.2",
"IPPrefixLen": 16,
"IPv6Gateway": "",
"MacAddress": "02:42:ac:11:00:02",
"Networks": {
"bridge": {
"IPAMConfig": null,
"Links": null,
"Aliases": null,
"NetworkID": "33deae47133f450e63d0e9ded2d0babc1a0b34ce50885a63a01ae18d9e357ddf",
"EndpointID": "1bfa563ee831522a547b1977a02d068d576e25427d3bc48c4b27ec76775858fc",
"Gateway": "172.17.0.1",
"IPAddress": "172.17.0.2",
"IPPrefixLen": 16,
"IPv6Gateway": "",
"GlobalIPv6Address": "",
"GlobalIPv6PrefixLen": 0,
"MacAddress": "02:42:ac:11:00:02",
"DriverOpts": null
}
}
}
}
]