This document contains descriptions of the .sh scripts developed for managing containers tailored for the TYRELL project. Of course, there are more comprehensive and sophisticated systems for managing docker containers graphically, such as portainer, but these require a more significant learning curve compared to these scripts. Feel free to use, share or change them for your proposal.
Our images are based on the official NVIDIA images, supports SSH connections, and include a XRDP server for remote graphical connections. You can customize these base images by means of a file named
packages.shthat can be used to install your particular software. Reader can check our "builds" opening some folder of this repo. For example,build_20_ros1builds a image based on ´nvidia/cuda:12.2.0-base-ubuntu20.04´ withROS1support.
This Bash script automates the process of building a Docker image. It performs the following steps:
-
Checks for the existence of the
image.txtfile: If the file does not exist, the script stops and displays an error message. -
Reads the image name from
image.txt: Extracts the value of theIMAGE_NAMEvariable from the file. -
Checks if the image already exists: If the image exists, the script:
-
Finds and lists containers that depend on that image.
-
Prompts for confirmation to stop and remove dependent containers.
-
Prompts for confirmation to delete the existing image.
-
-
Builds the new image: Uses docker build to create the image with the specified name and tag.
-
Lists available images: Displays a list of Docker images available on the system.
You can add a help option to the script to display the above description.
IMAGE_NAME=my_image_name
Run the script without arguments to build the Docker image:
./rebuild.sh
Use the -h or --help option to display the help message:
$ ./rebuild.sh -h
Please, refer to script play.sh to start the built container.
This Bash script automates the setup and configuration of a Docker container for a specific project. It performs the following tasks:
-
Validates Input Arguments: Ensures that exactly three arguments are provided:
<project name>,<container name>, and<port prefix>. -
Checks for Required Files: Verifies the existence of the
image.txtfile, which contains the Docker image name. -
Reads the Docker Image Name: Extracts the
IMAGE_NAMEfrom theimage.txtfile. -
Checks if the Docker Image Exists: Ensures the specified Docker image exists; if not, the script exits.
-
Creates Project Directories: Sets up the necessary directories for the project and container under
$HOME/docker/. -
Generates Configuration Files: Creates a config.txt file with project-specific details (e.g.,
IMAGE_NAME,CONTAINER_NAME,PORTS_PREFIX). If aconfig.txtalready exists, it renames it toconfig.bak. -
Generates Docker Compose File: Executes the
generate_compose.shscript to create adocker-compose.ymlfile. -
Copies Files to the Container: Copies files from a source directory (
scripts/root) to the container's home directory, skipping files that already exist in the destination.
You can add a help option to the script to display a summary of its functionality.
Run the script with the required arguments to set up the Docker container:
./script_name.sh <project_name> <container_name> <port_prefix>
Use the -h or --help option to display the help message:
./script_name.sh -h