From da47929b6a8919f5dc4d3a4df34e688da41ef4ca Mon Sep 17 00:00:00 2001 From: Wang Xu Date: Sat, 3 Oct 2015 15:11:35 +0800 Subject: [PATCH] add symlink /dev/{stdin,stdout,stderr} to /proc/self/fd/{0,1,2} This is what docker does, and will fix the other part of the issue of official nginx image problems Test result: ``` gnawux@sonic:~/go/src/github.com/hyperhq/hyper$ ./hyper run nginx POD id is pod-SwBxHnRdKH 192.168.123.1 - - [03/Oct/2015:07:06:27 +0000] "GET / HTTP/1.1" 200 612 "-" "curl/7.35.0" "-" ``` The curl in another term: ``` gnawux@sonic:~/c/hyperstart/build$ curl http://192.168.123.7/ Welcome to nginx!

Welcome to nginx!

If you see this page, the nginx web server is successfully installed and working. Further configuration is required.

For online documentation and support please refer to nginx.org.
Commercial support is available at nginx.com.

Thank you for using nginx.

``` Signed-off-by: Wang Xu --- src/container.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/container.c b/src/container.c index dec8703..daa2a02 100644 --- a/src/container.c +++ b/src/container.c @@ -389,6 +389,11 @@ static int hyper_container_init(void *data) goto fail; } + symlink("/proc/self/fd", "/dev/fd"); + symlink("/proc/self/fd/0", "/dev/stdin"); + symlink("/proc/self/fd/1", "/dev/stdout"); + symlink("/proc/self/fd/2", "/dev/stderr"); + execvp(container->exec.argv[0], container->exec.argv); perror("exec container command failed");