I have a fleet service in file nginx.service
which I am trying to launch on CoreOS:
[Unit]
Description=nginx
[Service]
User=core
TimeoutStartSec=0
EnvironmentFile=/etc/environment
ExecStartPre=-/usr/bin/docker stop nginx
ExecStartPre=-/usr/bin/docker rm nginx
ExecStart=/usr/bin/docker run --rm --name nginx -v /home/core/nginx/conf:/etc/nginx/conf:ro -p 80:80 nginx:latest
#
ExecStop=-/usr/bin/docker stop nginx
ExecStopPost=-/usr/bin/docker rm nginx
Restart=always
RestartSec=10s
[X-Fleet]
When I launch it with fleetctl start nginx.service
, it shows no erros, but then in the journal I see this when I try to visit the site:
Aug 24 15:00:09 core-01 docker[2839]: 172.17.8.1 - - [24/Aug/2016:15:00:09 +0000] "GET / HTTP/1.1" 403 571 "-" "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.116 Safari/537.36" "-"
Aug 24 15:00:09 core-01 docker[2839]: 2016/08/24 15:00:09 [error] 5#5: *1 directory index of "/usr/share/nginx/html/" is forbidden, client: 172.17.8.1, server: localhost, request: "GET / HTTP/1.1", host: "172.17.8.101"
Aug 24 15:00:09 core-01 docker[2839]: 2016/08/24 15:00:09 [error] 5#5: *1 open() "/usr/share/nginx/html/favicon.ico" failed (2: No such file or directory), client: 172.17.8.1, server: localhost, request: "GET /favicon.ico HTTP/1.1", host: "172.17.8.101", referrer: "http://172.17.8.101/"
Aug 24 15:00:09 core-01 docker[2839]: 172.17.8.1 - - [24/Aug/2016:15:00:09 +0000] "GET /favicon.ico HTTP/1.1" 404 571 "http://172.17.8.101/" "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.116 Safari/537.36" "-"
But if I start docker command from the fleet file:
/usr/bin/docker run --rm --name nginx -v /home/core/nginx/conf:/etc/nginx/conf:ro -p 80:80 nginx:latest
It runs properly and shows the correct pages.
What am I doing wrong and how to fix it?
0 Answers