Skip to content

Instantly share code, notes, and snippets.

@ruliana
Last active February 11, 2025 13:29
Show Gist options
  • Save ruliana/734cdb5ac730b9dd2afd0cbaab69b54c to your computer and use it in GitHub Desktop.
Save ruliana/734cdb5ac730b9dd2afd0cbaab69b54c to your computer and use it in GitHub Desktop.
Script to run an interactive shell from Stanford's XCS236 Docker image using Podman
#!/bin/bash
# Company file for XCS236 Docker image
# https://gist.github.com/ruliana/50e8e751ae0dc6af2a6b08d08bf2a027
# Check if the container image already exists
if podman image exists xcs236-env; then
echo "Container image already exists. Skipping build."
else
# Build the container
echo "Building container..."
podman build -t xcs236-env .
fi
# Check if the container already exists
if podman container exists xcs236-container; then
echo "Removing existing container..."
podman rm xcs236-container
fi
# Run the container with src directory mounted and remove it when exiting
echo "Running container..."
podman run -it --rm \
-v "$(pwd):/workspace" \
--name xcs236-container \
xcs236-env
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment