Skip to content

Commit

Permalink
use ubuntu image for size
Browse files Browse the repository at this point in the history
  • Loading branch information
scanon committed Nov 11, 2024
1 parent b864a8b commit c4394f5
Showing 1 changed file with 27 additions and 39 deletions.
66 changes: 27 additions & 39 deletions _episodes/23.run-hpc.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,31 +32,19 @@ cd ~/sc-tutorials/exercises

#### Singularity

Download ECP's Ubuntu 20.04 image using:
Download Ubuntu 20.04 image using:

```bash
singularity pull docker://ecpe4s/ubuntu20.04
singularity pull docker://ubuntu:20.04
```
```output
INFO: Converting OCI blobs to SIF format
INFO: Starting build...
Getting image source signatures
Copying blob 675920708c8b done
Copying blob 8ba2454310fe done
Copying blob 14833710fc9f done
...
Copying blob ab9bb56692d1 done
Copying blob 6d1c299f692a done
Copying config 713eae3dbe done
Writing manifest to image destination
Storing signatures
2022/10/11 05:10:39 info unpack layer: sha256:675920708c8bf10fbd02693dc8f43ee7dbe0a99cdfd55e06e6f1a8b43fd08e3f
2022/10/11 05:10:40 info unpack layer: sha256:8ba2454310fee5d84714acde4437d48a888844a0e569b9df36b5637073fad9fb
2022/10/11 05:10:41 info unpack layer: sha256:14833710fc9f06524846486bbb96c1a1043689386133e714c24ad3ebfad720db
...
2022/10/11 05:11:09 info unpack layer: sha256:b0bd5c6e49cc76e93dab9251446c4294eac10028483fef8c5209d0f9af1bfc60
2022/10/11 05:11:09 info unpack layer: sha256:ab9bb56692d116c3c07c5a2dd427186196e2e0a3417c791404ba09bd69e80e91
2022/10/11 05:11:09 info unpack layer: sha256:6d1c299f692aab503b4041bdf7896c185248d1acc4f8b7d73740452f0cfbe4d3
INFO: Creating SIF file...
```

Expand All @@ -68,27 +56,27 @@ The image file is just in your current directory:
ls
```
```output
ubuntu20.04_latest.sif
ubuntu_20.04.sif
```

Now let's execute some Linux commands from within the container, `whoami` and `cat /etc/os-release`:

```bash
singularity exec ubuntu20.04_latest.sif whoami
singularity exec ubuntu_20.04.sif whoami
```
```output
tutorial
trainingxx
```

```bash
singularity exec ubuntu20.04_latest.sif cat /etc/os-release
singularity exec ubuntu_20.04.sif cat /etc/os-release
```
```output
NAME="Ubuntu"
VERSION="20.04.5 LTS (Focal Fossa)"
VERSION="20.04.4 LTS (Focal Fossa)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 20.04.5 LTS"
PRETTY_NAME="Ubuntu 20.04.4 LTS"
VERSION_ID="20.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
Expand Down Expand Up @@ -149,15 +137,15 @@ By default, the cache is stored in `~/.singularity`; this location can be custom
A subcommand, `singularity cache`, can be used to manage the cache.


#### Shifter
#### Shifter (Optional: Use Perlmutter)

Let's download the same Ubuntu image as above, using `shifterimg`:

```bash
shifterimg pull ecpe4s/ubuntu20.04
shifterimg pull ubuntu:20.04
```
```output
2022-10-11T05:25:11 Pulling Image: docker:ecpe4s/ubuntu20.04, status: READY
2022-10-11T05:25:11 Pulling Image: docker:ubuntu:20.04, status: READY
```

Locally stored images are managed by Shifter itself:
Expand All @@ -166,38 +154,38 @@ Locally stored images are managed by Shifter itself:
shifterimg images
```
```output
mycluster docker READY 369c047181 2022-10-11T05:25:11 ecpe4s/ubuntu20.04:latest
perlmutter docker READY 8e5c4f0285 2024-11-11T12:43:04 ubuntu:20.04
```

What's the container user with Shifter? Let's use both `id -u` and `whoami`:
What's the container user with Shifter? Let's use both `id -u` and `whoami` (Note: the response depends on your training account):

```bash
shifter --image=ecpe4s/ubuntu20.04 whoami
shifter --image=ubuntu:20.04 whoami
```
```output
tutorial
train5
```

```bash
shifter --image=ecpe4s/ubuntu20.04 id -u
shifter --image=ubuntu:20.04 id -u
```
```output
1001
12962
```

Again, these come from the host.

You can try more Linux commands:

```bash
shifter --image=ecpe4s/ubuntu20.04 cat /etc/os-release
shifter --image=ubuntu:20.04 cat /etc/os-release
```
```output
NAME="Ubuntu"
VERSION="20.04.5 LTS (Focal Fossa)"
VERSION="20.04.6 LTS (Focal Fossa)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 20.04.5 LTS"
PRETTY_NAME="Ubuntu 20.04.6 LTS"
VERSION_ID="20.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
Expand Down Expand Up @@ -230,7 +218,7 @@ world
and with Shifter:

```bash
shifter --image=ecpe4s/ubuntu20.04 bash -c 'echo $HELLO'
shifter --image=ubuntu:20.04 bash -c 'echo $HELLO'
```
```output
world
Expand All @@ -248,7 +236,7 @@ singularity exec -e ubuntu20.04_latest.sif bash -c 'echo $HELLO'
and `-E` with Shifter:

```bash
shifter -E --image=ecpe4s/ubuntu20.04 bash -c 'echo $HELLO'
shifter -E --image=ubuntu:20.04 bash -c 'echo $HELLO'
```
```output
Expand Down Expand Up @@ -276,7 +264,7 @@ moon
And with Shifter:

```bash
shifter -E --env BYE="moon" --image=ecpe4s/ubuntu20.04 bash -c 'echo $BYE'
shifter -E --env BYE="moon" --image=ubuntu:20.04 bash -c 'echo $BYE'
```
```output
moon
Expand All @@ -289,7 +277,7 @@ By default and similar to Docker, Podman isolates host and container shell envir

```bash
export HELLO="world"
podman run ecpe4s/ubuntu20.04 bash -c 'echo $HELLO'
podman run ubuntu:20.04 bash -c 'echo $HELLO'
```
```output
Expand All @@ -298,7 +286,7 @@ podman run ecpe4s/ubuntu20.04 bash -c 'echo $HELLO'
You can pass specific variables to the container by using the flag `-e`:

```bash
podman run -e HELLO ecpe4s/ubuntu20.04 bash -c 'echo $HELLO'
podman run -e HELLO ubuntu:20.04 bash -c 'echo $HELLO'
```
```output
world
Expand All @@ -307,7 +295,7 @@ world
Or even redefine variables, with the same flag:

```bash
podman run -e HELLO=moon ecpe4s/ubuntu20.04 bash -c 'echo $HELLO'
podman run -e HELLO=moon ubuntu:20.04 bash -c 'echo $HELLO'
```
```output
moon
Expand Down Expand Up @@ -387,7 +375,7 @@ podman run marcodelapierre/ubuntu_workdir:18.04 pwd
```

```bash
podman run ecpe4s/ubuntu20.04 pwd
podman run ubuntu:20.04 pwd
```
```output
/
Expand Down

0 comments on commit c4394f5

Please sign in to comment.