Skip to content

Commit

Permalink
Exit if instance does not exist
Browse files Browse the repository at this point in the history
Signed-off-by: Anders F Björklund <[email protected]>
  • Loading branch information
afbjorklund committed May 12, 2022
1 parent 4cf1424 commit 052f79e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions cmd/docker.lima
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ set -eu
: "${LIMA_INSTANCE:=docker}"
: "${DOCKER:=docker}"

if [ "$(limactl ls -q "$LIMA_INSTANCE" 2>/dev/null)" != "$LIMA_INSTANCE" ]; then
echo "instance \"$LIMA_INSTANCE\" does not exist, run \`limactl start --name=$LIMA_INSTANCE template://docker\` to create a new instance" >&2
exit 1
fi
DOCKER=$(command -v "$DOCKER" || true)
if [ -n "$DOCKER" ]; then
DOCKER_HOST=$(limactl list "$LIMA_INSTANCE" --format 'unix://{{.Dir}}/sock/docker.sock')
Expand Down
4 changes: 4 additions & 0 deletions cmd/podman.lima
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ set -eu
: "${LIMA_INSTANCE:=podman}"
: "${PODMAN:=podman}"

if [ "$(limactl ls -q "$LIMA_INSTANCE" 2>/dev/null)" != "$LIMA_INSTANCE" ]; then
echo "instance \"$LIMA_INSTANCE\" does not exist, run \`limactl start --name=$LIMA_INSTANCE template://podman\` to create a new instance" >&2
exit 1
fi
PODMAN=$(command -v "$PODMAN" || true)
if [ -n "$PODMAN" ]; then
CONTAINER_HOST=$(limactl list "$LIMA_INSTANCE" --format 'unix://{{.Dir}}/sock/podman.sock')
Expand Down

0 comments on commit 052f79e

Please sign in to comment.