This is the user guide, divided into pre-installation steps and usage instructions.
This section provides installation instructions. For detailed steps, please refer to README_INSTALL.md.
-
Download this GitHub repository:
git clone https://github.com/AndersonYu7/docker.git docker
-
Move to the target directory:
cd docker -
Copy the files to your workspace:
cp -r . <workspace_path>
-
Adjust the Dockerfile to suit your needs.
-
Build the Docker image:
./build.sh {image_name}image_name: Name for the Docker image you choose
Example:
./build.sh ubuntu_image
-
Run the Docker container:
./run.sh {container_name} {image_name} [no-rm] [bash|terminator]container_name: Name for the Docker container.image_name: Docker image to use.no-rm: Optional flag. If provided, the container will NOT be removed after exit and will run in the background withtail -f.bash|terminator: Optional parameter to decide which command to use to attach to the container (default:terminator).
Example:
./run.sh my_container ubuntu_image # use --rm mode, attach with terminator ./run.sh my_container ubuntu_image no-rm bash # use no-rm mode, attach with bash
To delete a Docker container, use the delete.sh script:
./delete.sh {container_name}container_name: Name of the Docker container to delete.
Example:
./delete.sh my_containerThe delete.sh script will check if the container exists and whether it is running. If the container is running, it will prompt you to confirm if you want to stop and remove it. If the container is not running, it will be removed directly.