From 3d90d73422820a31d119fc34207caf643487fa02 Mon Sep 17 00:00:00 2001 From: Tung Leo Date: Sat, 16 Mar 2024 15:36:48 +0700 Subject: [PATCH 1/3] doc: init user guide --- README.md | 10 ++++++++++ docs/{ => troubleshooting}/TROUBLESHOOTING.md | 0 docs/usage/README.md | 7 +++++++ docs/usage/python_usage.md | 1 + 4 files changed, 18 insertions(+) rename docs/{ => troubleshooting}/TROUBLESHOOTING.md (100%) create mode 100644 docs/usage/README.md create mode 100644 docs/usage/python_usage.md diff --git a/README.md b/README.md index 2c81eee..cf4c048 100644 --- a/README.md +++ b/README.md @@ -71,7 +71,9 @@ chmod +x check_version_in_toolkit.sh ``` ## Use the official image from Docker Hub + DockerHub image [tungbq/devops-toolkit](https://hub.docker.com/r/tungbq/devops-toolkit) + ```bash docker pull tungbq/devops-toolkit:latest ``` @@ -101,15 +103,23 @@ docker run --rm devops-toolkit:latest ansible --version ## Running Sample Tool Code Inside the Toolkit Check out the full samples and instruction at [samples](./samples/) + - Run with default docker network + ```bash docker run --rm devops-toolkit:latest samples/run_sample.sh ``` + - Run with host network + ```bash docker run --network host --rm devops-toolkit:latest samples/run_sample.sh ``` +## User guide + +- [DevOps toolkit user guide](./docs/usage/) + ## The DevOps Toolkit Core Built on `ubuntu:22.04` base image diff --git a/docs/TROUBLESHOOTING.md b/docs/troubleshooting/TROUBLESHOOTING.md similarity index 100% rename from docs/TROUBLESHOOTING.md rename to docs/troubleshooting/TROUBLESHOOTING.md diff --git a/docs/usage/README.md b/docs/usage/README.md new file mode 100644 index 0000000..8e87062 --- /dev/null +++ b/docs/usage/README.md @@ -0,0 +1,7 @@ +# The devops-toolkit usage + +This guide us how to use the `devops-toolkit` with serveral usecases + +## Python + +- Check [python_usage](./python_usage.md) diff --git a/docs/usage/python_usage.md b/docs/usage/python_usage.md new file mode 100644 index 0000000..e9c101f --- /dev/null +++ b/docs/usage/python_usage.md @@ -0,0 +1 @@ +# Use python in the devops-toolkit From 58530aa678f274413ee5be974d60b3bef63a466a Mon Sep 17 00:00:00 2001 From: Tung Leo Date: Sat, 16 Mar 2024 16:54:07 +0700 Subject: [PATCH 2/3] doc: python user guide --- docs/troubleshooting/TROUBLESHOOTING.md | 8 +++-- docs/usage/python_usage.md | 40 +++++++++++++++++++++++++ 2 files changed, 46 insertions(+), 2 deletions(-) diff --git a/docs/troubleshooting/TROUBLESHOOTING.md b/docs/troubleshooting/TROUBLESHOOTING.md index fe89153..417f985 100644 --- a/docs/troubleshooting/TROUBLESHOOTING.md +++ b/docs/troubleshooting/TROUBLESHOOTING.md @@ -1,6 +1,10 @@ -- https://stackoverflow.com/questions/62154016/docker-on-wsl2-very-slow +# Most common error + +- - exec /usr/local/bin/kubectl: exec format error -See: https://stackoverflow.com/questions/73398714/docker-fails-when-building-on-m1-macs-exec-usr-local-bin-docker-entrypoint-sh +See: - Check architecure: dpkg --print-architecture + +- docker: Error response from daemon: Conflict. The container name "/my_devops_toolkit" is already in use by container diff --git a/docs/usage/python_usage.md b/docs/usage/python_usage.md index e9c101f..e90798b 100644 --- a/docs/usage/python_usage.md +++ b/docs/usage/python_usage.md @@ -1 +1,41 @@ # Use python in the devops-toolkit + +To use the existing container isntead of creating one, use `docker exec` command instead of `docker run` + +```bash +docker exec -it my_devops_toolkit /bin/bash +``` + +## Run python sample code provided in the container + +```bash +docker run --name my_devops_toolkit --network host -it devops-toolkit:latest +# You now in the container terminal +python3 samples/python/rectangle_area_calculator.py +``` + +## Clone external code to container + +```bash +docker run --name my_devops_toolkit --network host -it devops-toolkit:latest +# You now in the container terminal + +# Clone code +mkdir python_workspace +cd python_workspace +git clone https://github.com/geekcomputers/Python.git + +# Now run your cloned script +cd Python +python3 Day_of_week.py +``` + +## Mount external code to container + +Clone the code to the host then mount to container + +```bash +# Clone code on the host +docker run --name my_devops_toolkit -v "$(pwd)":/root/python_workspace --network host -it devops-toolkit:latest +# Run the python code as usual +``` From d81134b061ecbb3340759614c7b2cec05ebcae61 Mon Sep 17 00:00:00 2001 From: Tung Leo Date: Sat, 16 Mar 2024 16:55:13 +0700 Subject: [PATCH 3/3] doc: python user guide.v1 --- docs/usage/README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/usage/README.md b/docs/usage/README.md index 8e87062..18f7a6b 100644 --- a/docs/usage/README.md +++ b/docs/usage/README.md @@ -5,3 +5,7 @@ This guide us how to use the `devops-toolkit` with serveral usecases ## Python - Check [python_usage](./python_usage.md) + +## Troubleshooting + +- For any issues, check [this document](../troubleshooting/TROUBLESHOOTING.md)