Skip to content

Commit 00e8b4e

Browse files
committed
Add joining instance
1 parent 0d5d291 commit 00e8b4e

1 file changed

Lines changed: 19 additions & 1 deletion

File tree

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

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,27 @@ web3 792 /home/mibauer/nginx.img
6868
Once an instance is started, the environment inside of that instance will never change. If the service you want to run in your instance requires a bind mount, then you must pass the `-B` option when calling `instance.start`. For example, if you wish to capture the output of the `web1` container instance which is placed at `/output/` inside the container you could do:
6969

7070
```
71-
singularity instance.start -B output/dir/outside/:/output/ nginx.img web1
71+
$ singularity instance.start -B output/dir/outside/:/output/ nginx.img web1
7272
```
7373

74+
If you want to poke around inside of your instance, you can do a normal `singularity shell` command, but give it the instance URI:
75+
76+
```
77+
$ singularity shell instance://web1
78+
Singularity: Invoking an interactive shell within container...
79+
80+
Singularity pdf_server.img:~/>
81+
```
82+
83+
Similarly, you can use the `singularity run/exec` commands on instances:
84+
85+
```
86+
$ singularity run instance://web1
87+
$ singularity exec instance://web1 ps -ef
88+
```
89+
90+
When using `run` with an instance URI, the `runscript` will be executed inside of the instance. Similarly with `exec`, it will execute the given command in the instance.
91+
7492
## Putting it all together
7593

7694
In this section, we will demonstrate an example of packaging a service into a container and running it. The service we will be packaging is an API server that converts a web page into a PDF, and can be found [here](https://github.com/alvarcarto/url-to-pdf-api). The final example can be found [here on GitHub](https://github.com/bauerm97/instance-example), and [here on SingularityHub](link-to-shub). If you wish to just download the final image directly from Singularity Hub, simply run `singularity pull shub://bauerm97/instance-example`.

0 commit comments

Comments
 (0)