Skip to content

Commit 582a8df

Browse files
committed
updating quick start with shell
1 parent d8dc407 commit 582a8df

1 file changed

Lines changed: 19 additions & 3 deletions

File tree

pages/docs/overview/start.md

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,11 +125,27 @@ party_dinosaur.gif
125125
````
126126

127127
## Commands needing root
128-
The next set of actions, namely anything with `--writable` or bootstrap, do require you to use sudo. If you have been working on your shared resource, you will need to move to your personal laptop (and install Singularity if you haven't yet) before trying these out.
128+
The next set of actions, namely anything with `--writable` or bootstrap, do require you to use sudo, at least for most things. We can actually shell into a container, with `--writable`, and write to (some) locations for which we have permission to do so. Thus, this is possible to do, and will work depending on the permissions set in the container. For example, here let's shell in and try to write a root `/data` folder:
129+
130+
```bash
131+
singularity shell --writable centos7.img
132+
Singularity: Invoking an interactive shell within container...
133+
134+
Singularity centos7.img:~/Desktop> mkdir /data
135+
mkdir: cannot create directory '/data': Permission denied
136+
```
137+
138+
Oups. How about a folder in the present working directory?
139+
140+
```
141+
Singularity centos7.img:~/Desktop> touch file.txt
142+
```
143+
144+
This we are allowed to do, so it's not totally impossible to write some files in a container without sudo. However, for most things, you will need to use sudo with writable, discussed next. At this point, if you have been working on your shared resource, you will need to move to your personal laptop (and install Singularity if you haven't yet) before trying these out.
129145
130146
131147
### Writing in the container
132-
By default, containers run in read only. While we discourage making tweaks on the fly to containers (you should properly define all edits to the container in a boostrap specification file, shown later) you can add `--writable` to any command to write inside the container. Assuming we have our `centos7.img` on our local resource with sudo, let's make a directory.
148+
While we discourage making tweaks on the fly to containers (you should properly define all edits to the container in a boostrap specification file, shown later) you can add `--writable` to any command to write inside the container. Assuming we have our `centos7.img` on our local resource with sudo, let's try again to make that `/data` directory:
133149

134150

135151
```bash
@@ -139,7 +155,7 @@ Singularity centos7.img:/root> touch /data/noodles.txt
139155
exit
140156
```
141157

142-
Did we make noodles? Is the file still there?
158+
We made the data! And the noodles! But after we exit, is the file still there?
143159

144160
```bash
145161
singularity exec centos7.img ls /data

0 commit comments

Comments
 (0)