Skip to content

Commit f545ca7

Browse files
bauerm97vsoch
authored andcommitted
Add simple nginx example to instance docs (#131)
1 parent 9b56800 commit f545ca7

1 file changed

Lines changed: 55 additions & 2 deletions

File tree

pages/docs/user-docs/docs-instances.md

Lines changed: 55 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,13 +96,66 @@ When you are finished with your instance you can clean it up with the [`instance
9696
$ singularity instance.stop web1
9797
```
9898

99-
If you have multiple instances running and you want to stop all of them, you can do so with a wildcard:
99+
If you have multiple instances running and you want to stop all of them, you can do so with a wildcard or the -a flag:
100100

101101
```
102102
$ singularity instance.stop \*
103+
$ singularity instance.stop -a
103104
```
104105

105-
Note that you must escape the wildcard with a backslash like this `\*` to pass it properly.
106+
Note that you must escape the wildcard with a backslash like this `\*` to pass it properly.
107+
108+
## Nginx "Hello-world" in Singularity
109+
110+
Let's take a look at setting up a sample nginx web server using instances in Singularity. First we will just create a basic definition file:
111+
112+
```
113+
Bootstrap: docker
114+
From: nginx
115+
Includecmd: no
116+
117+
%startscript
118+
nginx
119+
```
120+
121+
All this does is download the official nginx Docker container, convert it to a Singularity image, and tell it to run nginx when you start the instance. Since we're running a web server, we're going to run the following commands as root.
122+
123+
```
124+
# singularity build nginx.img Singularity
125+
# singularity instance.start nginx.img web1
126+
```
127+
128+
Just like that we've downloaded, built, and ran an nginx Singularity image. And to confirm that it's correctly running:
129+
130+
```
131+
$ curl localhost
132+
127.0.0.1 - - [06/Oct/2017:21:46:43 +0000] "GET / HTTP/1.1" 200 612 "-" "curl/7.47.0" "-"
133+
<!DOCTYPE html>
134+
<html>
135+
<head>
136+
<title>Welcome to nginx!</title>
137+
<style>
138+
body {
139+
width: 35em;
140+
margin: 0 auto;
141+
font-family: Tahoma, Verdana, Arial, sans-serif;
142+
}
143+
</style>
144+
</head>
145+
<body>
146+
<h1>Welcome to nginx!</h1>
147+
<p>If you see this page, the nginx web server is successfully installed and
148+
working. Further configuration is required.</p>
149+
150+
<p>For online documentation and support please refer to
151+
<a href="http://nginx.org/">nginx.org</a>.<br/>
152+
Commercial support is available at
153+
<a href="http://nginx.com/">nginx.com</a>.</p>
154+
155+
<p><em>Thank you for using nginx.</em></p>
156+
</body>
157+
</html>
158+
```
106159

107160
## Putting it all together
108161

0 commit comments

Comments
 (0)