From c2dbffd666c94768dc6003cd5cf64a92a2ff2b0a Mon Sep 17 00:00:00 2001 From: mtabriz <39205857+MFTabriz@users.noreply.github.com> Date: Tue, 10 Nov 2020 16:18:56 +0100 Subject: [PATCH] add basic Charliecloud commands https://github.com/hpc/charliecloud --- sheets/ch-build | 6 ++++++ sheets/ch-build2dir | 6 ++++++ sheets/ch-builder2squash | 6 ++++++ sheets/ch-builder2tar | 6 ++++++ sheets/ch-dir2squash | 6 ++++++ sheets/ch-grow | 9 +++++++++ sheets/ch-mount | 7 +++++++ sheets/ch-pull2dir | 6 ++++++ sheets/ch-pull2tar | 7 +++++++ sheets/ch-run | 6 ++++++ sheets/ch-tar2dir | 6 ++++++ 11 files changed, 71 insertions(+) create mode 100644 sheets/ch-build create mode 100644 sheets/ch-build2dir create mode 100644 sheets/ch-builder2squash create mode 100644 sheets/ch-builder2tar create mode 100644 sheets/ch-dir2squash create mode 100644 sheets/ch-grow create mode 100644 sheets/ch-mount create mode 100644 sheets/ch-pull2dir create mode 100644 sheets/ch-pull2tar create mode 100644 sheets/ch-run create mode 100644 sheets/ch-tar2dir diff --git a/sheets/ch-build b/sheets/ch-build new file mode 100644 index 0000000..4ab702c --- /dev/null +++ b/sheets/ch-build @@ -0,0 +1,6 @@ +# ch-build +# Utility to build a Charliecloud image and place it in the builder’s back-end storage. More information: . + +# Create an image tagged foo and specified by the file /bar/Dockerfile. Use /bar as the Docker context directory. Use the default builder. +ch-build -t foo --file=/bar/Dockerfile /bar + diff --git a/sheets/ch-build2dir b/sheets/ch-build2dir new file mode 100644 index 0000000..5b85679 --- /dev/null +++ b/sheets/ch-build2dir @@ -0,0 +1,6 @@ +# ch-build2dir +# Utility to build a Charliecloud image from Dockerfile and unpack it into a directory. More information: . + +# Build a Charliecloud image using ./Dockerfile.foo and create image directory /var/tmp/foo +ch-build2dir -t foo -f ./Dockerfile.foo . /var/tmp + diff --git a/sheets/ch-builder2squash b/sheets/ch-builder2squash new file mode 100644 index 0000000..1fdb225 --- /dev/null +++ b/sheets/ch-builder2squash @@ -0,0 +1,6 @@ +# ch-builder2squash +# Utility to flatten a builder image into a Charliecloud SquashFS file. More information: . + +# Flattens the builder image tagged "debian" into a SquashFS file named debian.sqfs in /var/tmp. +ch-builder2squash debian /var/tmp + diff --git a/sheets/ch-builder2tar b/sheets/ch-builder2tar new file mode 100644 index 0000000..8de09d5 --- /dev/null +++ b/sheets/ch-builder2tar @@ -0,0 +1,6 @@ +# ch-builder2tar +# Utility to flatten a builder image into a Charliecloud image tarball. More information: . + +# Flatten the builder image tagged "hello" into a Charliecloud tarball in directory /var/tmp +ch-builder2tar hello /var/tmp + diff --git a/sheets/ch-dir2squash b/sheets/ch-dir2squash new file mode 100644 index 0000000..cab622c --- /dev/null +++ b/sheets/ch-dir2squash @@ -0,0 +1,6 @@ +# ch-dir2squash +# Utility to create a SquashFS file from a Charliecloud image directory. More information: . + +# Create a Charliecloud SquashFS file debian.sqfs from the image directory /var/tmp/debian under the directory /var/tmp. +ch-dir2squash /var/tmp/debian /var/tmp + diff --git a/sheets/ch-grow b/sheets/ch-grow new file mode 100644 index 0000000..110b857 --- /dev/null +++ b/sheets/ch-grow @@ -0,0 +1,9 @@ +# ch-grow +# Utility to build and manage Charliecloud images but not running them. It is completely unprivileged, with no setuid/setgid/setcap helpers. More information: . + +# Build the image "bar" using ./foo/bar/Dockerfile and context directory ./foo/bar +ch-grow build -t bar -f ./foo/bar/Dockerfile ./foo/bar + +# Download the Debian Buster image and place it in /tmp/buster. +ch-grow pull debian:buster /tmp/buster + diff --git a/sheets/ch-mount b/sheets/ch-mount new file mode 100644 index 0000000..87602d4 --- /dev/null +++ b/sheets/ch-mount @@ -0,0 +1,7 @@ +# ch-mount +# Utility to mount a SquashFS image file using FUSE. More information: . + + +# Create a new empty directory named debian, then mount it on /var/tmp directory. The /var/tmp directory must not already exist. +ch-mount /var/tmp/debian.sqfs /var/tmp + diff --git a/sheets/ch-pull2dir b/sheets/ch-pull2dir new file mode 100644 index 0000000..adeaa4d --- /dev/null +++ b/sheets/ch-pull2dir @@ -0,0 +1,6 @@ +# ch-pull2dir +# Utility to pull an image from the Docker Hub and unpack it into a directory. More information: . + +# Pull Docker image named alpine:latest from Docker Hub and extract it into a subdirectory of /var/tmp. A temporary tarball will be stored in /var/tmp. +ch-pull2dir alpine:latest /var/tmp + diff --git a/sheets/ch-pull2tar b/sheets/ch-pull2tar new file mode 100644 index 0000000..9d13dd9 --- /dev/null +++ b/sheets/ch-pull2tar @@ -0,0 +1,7 @@ +# ch-pull2tar +# Utility to pull an image from the Docker Hub and flatten it into a tarball. More information: . + + +# Pull a Docker image named alpine:latest from Docker Hub and flatten it into a Charliecloud tarball in the directory /var/tmp. +ch-pull2tar alpine:latest /var/tmp + diff --git a/sheets/ch-run b/sheets/ch-run new file mode 100644 index 0000000..5cadb7f --- /dev/null +++ b/sheets/ch-run @@ -0,0 +1,6 @@ +# ch-run +# Utility to run a command in a Charliecloud container. More information: . + +# Run the command echo hello inside a Charliecloud container using the unpacked image at /data/foo. +ch-run /data/foo -- echo hello + diff --git a/sheets/ch-tar2dir b/sheets/ch-tar2dir new file mode 100644 index 0000000..ec5569e --- /dev/null +++ b/sheets/ch-tar2dir @@ -0,0 +1,6 @@ +# ch-tar2dir +# Utility to unpack a Charliecloud image tarball into a directory. More information: . + +# Extract the tarball /var/tmp/hello.tar.gz into a subdirectory of /var/tmp. hello.tar.gz must contain a Linux filesystem image, e.g. as created by ch-builder2tar. +ch-tar2dir /var/tmp/hello.tar.gz /var/tmp +