forked from rootless-containers/usernetes
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request rootless-containers#305 from AkihiroSuda/podman
Support CONTAINER_ENGINE=(podman|nerdctl) in addition to docker
- Loading branch information
Showing
12 changed files
with
236 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
#!/bin/bash | ||
set -eu -o pipefail | ||
: "${CONTAINER_ENGINE:=}" | ||
: "${COMPOSE:=}" | ||
|
||
if [ -z "${CONTAINER_ENGINE}" ]; then | ||
if command -v dockerd-rootless.sh >/dev/null 2>&1; then | ||
CONTAINER_ENGINE=docker | ||
elif command -v containerd-rootless.sh >/dev/null 2>&1; then | ||
CONTAINER_ENGINE=nerdctl | ||
elif command -v podman >/dev/null 2>&1; then | ||
CONTAINER_ENGINE=podman | ||
else | ||
echo >&2 "$0: no container engine was detected" | ||
exit 1 | ||
fi | ||
fi | ||
|
||
CONTAINER_ENGINE_TYPE=docker | ||
if [[ "${CONTAINER_ENGINE}" = *"podman"* ]]; then | ||
CONTAINER_ENGINE_TYPE=podman | ||
elif [[ "${CONTAINER_ENGINE}" = *"nerdctl"* ]]; then | ||
CONTAINER_ENGINE_TYPE=nerdctl | ||
fi | ||
|
||
if [ -z "${COMPOSE}" ]; then | ||
COMPOSE="${CONTAINER_ENGINE} compose" | ||
if [ "${CONTAINER_ENGINE_TYPE}" = "podman" ]; then | ||
COMPOSE=podman-compose | ||
fi | ||
fi | ||
|
||
case "$#" in | ||
0) | ||
echo "CONTAINER_ENGINE=${CONTAINER_ENGINE}" | ||
echo "CONTAINER_ENGINE_TYPE=${CONTAINER_ENGINE_TYPE}" | ||
echo "COMPOSE=${COMPOSE}" | ||
;; | ||
1) | ||
case "$1" in | ||
"CONTAINER_ENGINE" | "CONTAINER_ENGINE_TYPE" | "COMPOSE") | ||
echo "${!1}" | ||
;; | ||
*) | ||
echo >&2 "$0: unknown argument: $1" | ||
exit 1 | ||
;; | ||
esac | ||
;; | ||
*) | ||
echo >&2 "$0: too many arguments" | ||
exit 1 | ||
;; | ||
esac |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#!/bin/bash | ||
# This script installs the latest release of Podman. | ||
# Repository information is from https://podman.io/docs/installation#linux-distributions | ||
set -eux -o pipefail | ||
if [ "$(id -u)" != "0" ]; then | ||
echo "Must run as the root" | ||
exit 1 | ||
fi | ||
|
||
if command -v dnf >/dev/null 2>&1; then | ||
dnf install -y podman podman-compose | ||
else | ||
mkdir -p /etc/apt/keyrings | ||
curl -fsSL "https://download.opensuse.org/repositories/devel:kubic:libcontainers:unstable/xUbuntu_$(lsb_release -rs)/Release.key" | | ||
gpg --dearmor | | ||
tee /etc/apt/keyrings/devel_kubic_libcontainers_unstable.gpg >/dev/null | ||
echo \ | ||
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/devel_kubic_libcontainers_unstable.gpg]\ | ||
https://download.opensuse.org/repositories/devel:kubic:libcontainers:unstable/xUbuntu_$(lsb_release -rs)/ /" | | ||
tee /etc/apt/sources.list.d/devel:kubic:libcontainers:unstable.list >/dev/null | ||
apt-get update -qq | ||
apt-get -qq -y install podman | ||
# No dpkg for podman-compose ? | ||
pip3 install podman-compose | ||
fi |
Oops, something went wrong.