Compare commits
1 Commits
6087426e08
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a43de98578 |
@@ -11,6 +11,7 @@ It offers a clean, interactive menu for common Docker operations like pulling im
|
||||
- 🔹 **Interactive container management** — start, stop, remove, or attach to containers with simple numbered menus.
|
||||
- 🔹 **Port mapping made clear** — automatically prompts for and explains host ↔ container port bindings.
|
||||
- 🔹 **Image operations** — pull, list, and delete Docker images.
|
||||
- 🔹 **Script-to-image workflow** — turn a bash setup script into a Dockerfile and build the resulting image in one go.
|
||||
- 🔹 **Quick MySQL setup** — spin up a MySQL container with version, password, and port configuration in seconds.
|
||||
- 🔹 **Get container IP address** — cleanly retrieves and displays only the container’s assigned IP.
|
||||
- 🔹 **Modern C++ design** — built with classes, minimal dependencies, and clear abstractions.
|
||||
@@ -59,7 +60,8 @@ Tux-Dock: Docker Management Menu
|
||||
10. Attach Shell to Running Container
|
||||
11. Spin Up MySQL Container
|
||||
12. Get Container IP Address
|
||||
13. Exit
|
||||
13. Create Dockerfile & Build Image from Bash Script
|
||||
14. Exit
|
||||
```
|
||||
|
||||
Each action guides you through the required steps.
|
||||
|
||||
19
main.cpp
19
main.cpp
@@ -197,7 +197,7 @@ void DockerManager::showContainerIP() {
|
||||
}
|
||||
|
||||
void DockerManager::createDockerfile() {
|
||||
string baseImage, bashScriptPath, outputFile;
|
||||
string baseImage, bashScriptPath, outputFile, imageName;
|
||||
cout << "Enter base Docker image (e.g., ubuntu:22.04): ";
|
||||
cin >> baseImage;
|
||||
|
||||
@@ -243,8 +243,17 @@ void DockerManager::createDockerfile() {
|
||||
scriptFile.close();
|
||||
|
||||
cout << "Dockerfile created successfully: " << outputFile << "\n";
|
||||
cout << "You can edit it or build it with:\n";
|
||||
cout << " docker build -t myimage -f " << outputFile << " .\n";
|
||||
cout << "Enter image name to build from this Dockerfile (e.g., myimage): ";
|
||||
cin >> imageName;
|
||||
|
||||
if (imageName.empty()) {
|
||||
cout << "No image name provided. Skipping build.\n";
|
||||
return;
|
||||
}
|
||||
|
||||
cout << "Building Docker image '" << imageName << "'...\n";
|
||||
runCommand("docker build -t " + imageName + " -f " + outputFile + " .");
|
||||
cout << "Docker build command executed.\n";
|
||||
}
|
||||
|
||||
// ---------------- Menu ----------------
|
||||
@@ -268,7 +277,7 @@ int main() {
|
||||
<< "10. Attach Shell to Running Container\n"
|
||||
<< "11. Spin Up MySQL Container\n"
|
||||
<< "12. Get Container IP Address\n"
|
||||
<< "13. Create Dockerfile from Bash Script\n"
|
||||
<< "13. Create Dockerfile & Build Image from Bash Script\n"
|
||||
<< "14. Exit\n"
|
||||
<< "----------------------------------\n"
|
||||
<< "Choose an option: ";
|
||||
@@ -297,5 +306,3 @@ int main() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
6
option13_script.sh
Normal file
6
option13_script.sh
Normal file
@@ -0,0 +1,6 @@
|
||||
#!/bin/bash
|
||||
echo "Setting up application directory"
|
||||
mkdir -p /app/bin
|
||||
echo '#!/bin/bash' > /app/bin/run.sh
|
||||
echo 'echo "Hello from Tux-Dock generated image"' >> /app/bin/run.sh
|
||||
chmod +x /app/bin/run.sh
|
||||
Reference in New Issue
Block a user