Skip to content

Commit

Permalink
updating example to have run
Browse files Browse the repository at this point in the history
Signed-off-by: vsoch <vsoch@users.noreply.github.com>
  • Loading branch information
vsoch committed Feb 28, 2021
1 parent 5a47aaa commit 8378ab7
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 5 deletions.
10 changes: 7 additions & 3 deletions v2.0/ping/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,19 +57,23 @@ commands):
```bash
$ singularity-compose --debug up -d
Creating alp1
DEBUG singularity instance start --fakeroot --net --network-args "portmap=1025:1025/tcp" --network-args "IP=10.22.0.2" --hostname alp1 --writable-tmpfs /home/vanessa/Desktop/Code/singularity-compose-examples/v2.0/ping/alp1.sif alp1
DEBUG singularity instance start --bind /home/vanessa/Desktop/Code/singularity-compose-examples/v2.0/ping/resolv.conf:/etc/resolv.conf --bind /home/vanessa/Desktop/Code/singularity-compose-examples/v2.0/ping/etc.hosts:/etc/hosts --fakeroot --net --network-args "portmap=1025:1025/tcp" --network-args "IP=10.22.0.2" --hostname alp1 --writable-tmpfs /home/vanessa/Desktop/Code/singularity-compose-examples/v2.0/ping/alp1/alp1.sif alp1
WARNING: Disabling --writable-tmpfs as it can't be used in conjunction with underlay
DEBUG singularity exec --env-file=myvars.env instance://alp1 printenv SUPERHERO
PANCAKEMAN
Creating alp2
DEBUG singularity instance start --fakeroot --net --network-args "portmap=1026:1026/tcp" --network-args "IP=10.22.0.3" --hostname alp2 --writable-tmpfs /home/vanessa/Desktop/Code/singularity-compose-examples/v2.0/ping/alp2.sif alp2
DEBUG singularity instance start --bind /home/vanessa/Desktop/Code/singularity-compose-examples/v2.0/ping/resolv.conf:/etc/resolv.conf --bind /home/vanessa/Desktop/Code/singularity-compose-examples/v2.0/ping/etc.hosts:/etc/hosts --fakeroot --net --network-args "portmap=1026:1026/tcp" --network-args "IP=10.22.0.3" --hostname alp2 --writable-tmpfs /home/vanessa/Desktop/Code/singularity-compose-examples/v2.0/ping/alp2/alp2.sif alp2
WARNING: Disabling --writable-tmpfs as it can't be used in conjunction with underlay

DEBUG singularity run instance://alp2
This shows the alp2 example being run after creation
```

In the above, we see that the exec works because it's printing the environment variable we provided.
We can now test the instances. They should be able to interact with one another.
The second instance (alp2) has a runscript provided, so the empty run section is a signal to use it.
We can also add args to run and options. We can now test the instances. They should be able to interact with one another.

```bash
$ singularity exec instance://alp2 ping -c 2 `singularity instance list | grep alp1 | grep -o '10.* '`
Expand Down
File renamed without changes.
5 changes: 5 additions & 0 deletions v2.0/ping/alp2/Singularity
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Bootstrap: docker
From: alpine:latest

%runscript
echo "This shows the alp2 example being run after creation"
5 changes: 3 additions & 2 deletions v2.0/ping/singularity-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: "2.0"
instances:
alp1:
build:
context: ./
context: ./alp1
options:
- fakeroot
ports:
Expand All @@ -16,13 +16,14 @@ instances:
command: printenv SUPERHERO
alp2:
build:
context: ./
context: ./alp2
options:
- fakeroot
ports:
- "1026:1026"
start:
options:
- fakeroot
run: []
depends_on:
- alp1

0 comments on commit 8378ab7

Please sign in to comment.