Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support container management in demo #119

Merged
merged 1 commit into from
Nov 10, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 7 additions & 27 deletions images/common/optional-installer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,43 +6,23 @@ TEST_USER=${TEST_USER:-iotadmin}

command_exists() { command -v "$1" >/dev/null 2>&1; }

install_docker_cli() {
sudo apt-get update
sudo apt-get install ca-certificates curl
sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL https://download.docker.com/linux/debian/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc

echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/debian \
$(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

sudo apt-get update -y
sudo apt-get install -y --no-install-recommends \
docker-ce-cli \
docker-compose-plugin

# create systemd-tmpfiles config to create a symlink for docker to the podman socket
# which allows using docker and docker compose without having to set the DOCKER_HOST variable
# Source: podman-docker debian package
echo 'L+ %t/docker.sock - - - - %t/podman/podman.sock' | tee /usr/lib/tmpfiles.d/podman-docker-socket.conf
systemd-tmpfiles --create podman-docker.conf >/dev/null || true
}

install_container_management () {
# Install with all recommended packages as this is simplier to maintain
# Note: Use podman instead of docker-ce as docker-ce at build time fails. See https://github.com/docker/cli/issues/4807
# Note: Use podman instead of docker-ce as docker-ce fails at build time. See https://github.com/docker/cli/issues/4807
mkdir -p /etc/containers/
touch /etc/containers/nodocker
sudo apt-get update -y
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y \
podman \
podman-compose \
tedge-container-plugin \
tedge-container-plugin-ng \
unzip

install_docker_cli
# create systemd-tmpfiles config to create a symlink for docker to the podman socket
# which allows using docker and docker compose without having to set the DOCKER_HOST variable
# Source: podman-docker debian package
echo 'L+ %t/docker.sock - - - - %t/podman/podman.sock' | tee /usr/lib/tmpfiles.d/podman-docker-socket.conf
systemd-tmpfiles --create podman-docker.conf >/dev/null || true
}

configure_users() {
Expand Down