mirror of https://github.com/knative/func.git
Adding simple Podman insecure registry support (#2060)
Signed-off-by: Matthias Wessendorf <mwessend@redhat.com>
This commit is contained in:
parent
bc1acd1ff3
commit
a4680b28d7
|
@ -8,6 +8,7 @@ set -o errexit
|
|||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
CONTAINER_ENGINE=${CONTAINER_ENGINE:-docker}
|
||||
export TERM="${TERM:-dumb}"
|
||||
|
||||
main() {
|
||||
|
@ -16,18 +17,34 @@ main() {
|
|||
|
||||
echo "${em}Configuring for CI...${me}"
|
||||
|
||||
set_registry_insecure
|
||||
|
||||
# Check the value of CONTAINER_ENGINE
|
||||
echo 'Setting registry as trusted local-only'
|
||||
if [ "$CONTAINER_ENGINE" == "docker" ]; then
|
||||
set_registry_insecure
|
||||
elif [ "$CONTAINER_ENGINE" == "podman" ]; then
|
||||
set_registry_insecure_podman
|
||||
fi
|
||||
|
||||
echo "${em}DONE${me}"
|
||||
|
||||
}
|
||||
|
||||
set_registry_insecure() {
|
||||
echo 'Setting registry as trusted local-only'
|
||||
patch=".\"insecure-registries\" = [\"localhost:50000\""]
|
||||
sudo jq "$patch" /etc/docker/daemon.json > /tmp/daemon.json.tmp && sudo mv /tmp/daemon.json.tmp /etc/docker/daemon.json
|
||||
sudo service docker restart
|
||||
}
|
||||
|
||||
set_registry_insecure_podman() {
|
||||
FILE="/etc/containers/registries.conf"
|
||||
|
||||
# Check if the section exists
|
||||
if ! sudo grep -q "\[\[registry-insecure-local\]\]" "$FILE"; then
|
||||
# Append the new section to the file
|
||||
echo -e "\n[[registry-insecure-local]]\nlocation = \"localhost:50000\"\ninsecure = true" | sudo tee -a "$FILE" > /dev/null
|
||||
fi
|
||||
}
|
||||
|
||||
main "$@"
|
||||
|
||||
|
|
Loading…
Reference in New Issue