You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Sayali Oak edited this page Jul 30, 2024
·
1 revision
This document provides instructions for creating and running a Docker container using a Python script. The script pulls a Docker image from Docker Hub, removes any existing container with the same name, and starts a new container. The instructions are applicable for both Windows and MacOS users.
Requirements
Docker installed and running on your system (Windows or MacOS).
The Python script link is provided above. It automates the process of pulling a Docker image, removing any existing container, and running a new container. It also provides an option to include SQL scripts for database initialization.
NOTE: If you have SQL scripts for database initialization (adding dummy data), set the 'SQL_SCRIPTS_DIR' and 'CONTAINER_SCRIPTS_DIR' variables, and uncomment the respective lines in the script.
Running the Script
Save the Python script to a file, e.g., 'run_docker_container.py'.
Open a terminal or command prompt and navigate to the directory containing the script.
Run the script using the command: python run_docker_container.py
NOTE: The error message "No such container" is expected when the script tries to remove a container that doesn't exist. This message is not an error in the script's logic; it's simply Docker's way of informing you that there was no existing container to remove.