Last active
February 11, 2025 13:29
-
-
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
This file contains hidden or 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
#!/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