Files
TSYSDevStack/Toolbox/base/run.sh
2025-11-11 21:00:37 -06:00

31 lines
1.2 KiB
Bash
Executable File

#!/bin/bash
# Run script for tsysdevstack-toolboxstack-toolbox-base Docker container
set -e # Exit immediately if a command exits with a non-zero status
IMAGE_NAME="tsysdevstack-toolboxstack-toolbox-base"
echo "Starting Docker container from image: $IMAGE_NAME"
# Check if Docker socket exists on the host
if [ ! -S /var/run/docker.sock ]; then
echo "Warning: Docker socket not found at /var/run/docker.sock"
echo "Docker commands inside the container will not work without access to the host's Docker daemon."
echo "Please ensure your user is in the 'docker' group on the host system."
echo "Running container without Docker socket access..."
# Run the Docker container interactively with a pseudo-TTY without Docker socket
docker run -it --rm \
--name tsysdevstack-container \
"$IMAGE_NAME"
else
echo "Docker socket found. Mounting to container for Docker access..."
# Run the Docker container interactively with a pseudo-TTY
# Mount Docker socket to enable Docker commands inside container
docker run -it --rm \
-v /var/run/docker.sock:/var/run/docker.sock \
--name tsysdevstack-container \
"$IMAGE_NAME"
fi