Skip to content

Commit 02ca63f

Browse files
GodloveDvsoch
authored andcommitted
add sudo where necessary (#128)
1 parent d6cff7a commit 02ca63f

1 file changed

Lines changed: 8 additions & 6 deletions

File tree

pages/docs/user-docs/action-build.md

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,12 @@ The same information applies to containers built from Docker Hub and containers
6161
## Creating `--writable` images and `--sandbox` directories
6262

6363
### `--writable`
64-
If you wanted to create a writable ext3 image similar to those used by Singularity version < 2.4, you could do so with the `--writable` option. Extending the Singularity Hub example from above:
64+
If you wanted to create a writable ext3 image similar to those used by Singularity version < 2.4, you could do so with the `--writable` option. You must create writable containers as root.
65+
66+
Extending the Singularity Hub example from above:
6567

6668
```
67-
$ singularity build --writable lolcow.img shub://GodloveD/lolcow
69+
$ sudo singularity build --writable lolcow.img shub://GodloveD/lolcow
6870
6971
```
7072

@@ -77,10 +79,10 @@ $ sudo singularity shell --writable lolcow.img
7779
```
7880

7981
### `--sandbox`
80-
If you wanted to create a container within a writable directory (called a _sandbox_) you could do so with the `--sandbox` option:
82+
If you wanted to create a container within a writable directory (called a _sandbox_) you could do so with the `--sandbox` option. It's possible to create a sandbox without root privileges, but to ensure proper file permissions it is recommended to do so as root.
8183

8284
```
83-
$ singularity build --sandbox lolcow/ shub://GodloveD/lolcow
85+
$ sudo singularity build --sandbox lolcow/ shub://GodloveD/lolcow
8486
```
8587

8688
The resulting directory operates just like a container in an image file. You are permitted to make changes and write files within the directory, but those changes will not persist when you are finished using the container. To make your changes persistent, use the `--writable` flag when you invoke your container.
@@ -95,7 +97,7 @@ $ sudo singularity shell --writable lolcow/
9597
If you already have a container saved locally, you can use it as a target to build a new container. This allows you convert containers from one format to another. For example if you had a squashfs container called `production.simg` and wanted to convert it to a writeable ext3 container called `development.img` you could:
9698

9799
```
98-
$ singularity build --writable development.img production.simg
100+
$ sudo singularity build --writable development.img production.simg
99101
```
100102

101103
Similarly, to convert it to a writable directory (a sandbox):
@@ -107,7 +109,7 @@ $ singularity build --sandbox development/ production.simg
107109
If you omit any options you can also convert your sandbox back to a read-only compressed squashfs image suitable for use in a production environment:
108110

109111
```
110-
$ singularty build production2 development/
112+
$ singularity build production2 development/
111113
```
112114
You can convert the three supported container formats using any combination.
113115

0 commit comments

Comments
 (0)