summaryrefslogtreecommitdiff
path: root/src/op_mode
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2021-04-13 19:03:12 +0200
committerGitHub <noreply@github.com>2021-04-13 19:03:12 +0200
commitf5be83ccde5f164ffb9a0e9d5f1f2631f39e8216 (patch)
tree389664446401b09a7872d8e81564a0e6a92e3e5c /src/op_mode
parent1c38135e3312cddd198db948efacc0c2d3d8e2cf (diff)
parent0dda528ca127714f207d37549b81ba700a371f4e (diff)
downloadvyos-1x-f5be83ccde5f164ffb9a0e9d5f1f2631f39e8216.tar.gz
vyos-1x-f5be83ccde5f164ffb9a0e9d5f1f2631f39e8216.zip
Merge pull request #801 from sever-sever/T2216-pod
containers: T2216: Add podman for containers
Diffstat (limited to 'src/op_mode')
-rwxr-xr-xsrc/op_mode/containers_op.sh51
1 files changed, 51 insertions, 0 deletions
diff --git a/src/op_mode/containers_op.sh b/src/op_mode/containers_op.sh
new file mode 100755
index 000000000..bdc0ead98
--- /dev/null
+++ b/src/op_mode/containers_op.sh
@@ -0,0 +1,51 @@
+#!/usr/bin/env bash
+
+# Expect 2 args or "show-containers" or "show-images"
+if [[ $# -ne 2 ]] && [[ $1 != "--show-containers" ]] && [[ $1 != "--show-images" ]] ; then
+ echo "Image not set or not found"
+ exit 1
+fi
+
+OPTION=$1
+IMAGE=$2
+
+# Download image
+pull_image() {
+ sudo podman pull ${IMAGE}
+}
+
+# Remove image
+remove_image() {
+ sudo podman image rm ${IMAGE}
+}
+
+# Show containers
+show_containers() {
+ sudo podman ps -a
+}
+
+# Show image
+show_images() {
+ sudo podman image ls
+}
+
+
+if [ "$OPTION" = "--pull" ]; then
+ pull_image
+ exit 0
+fi
+
+if [ "$OPTION" = "--remove" ]; then
+ remove_image
+ exit 0
+fi
+
+if [ "$OPTION" = "--show-containers" ]; then
+ show_containers
+ exit 0
+fi
+
+if [ "$OPTION" = "--show-images" ]; then
+ show_images
+ exit 0
+fi