diff --git a/README.md b/README.md index cf4c048..feb60c6 100644 --- a/README.md +++ b/README.md @@ -119,6 +119,7 @@ docker run --network host --rm devops-toolkit:latest samples/run_sample.sh ## User guide - [DevOps toolkit user guide](./docs/usage/) +- [Troubleshooting](./docs/troubleshooting/) ## The DevOps Toolkit Core diff --git a/docs/troubleshooting/TROUBLESHOOTING.md b/docs/troubleshooting/TROUBLESHOOTING.md index 417f985..2af51bd 100644 --- a/docs/troubleshooting/TROUBLESHOOTING.md +++ b/docs/troubleshooting/TROUBLESHOOTING.md @@ -1,10 +1,14 @@ # Most common error +#### docker-on-wsl2-very-slow + - -- exec /usr/local/bin/kubectl: exec format error -See: +#### exec /usr/local/bin/kubectl: exec format error + +- See: +Check architecure: dpkg --print-architecture -- Check architecure: dpkg --print-architecture +#### docker: Error response from daemon: Conflict. The container name "/my_devops_toolkit" is already in use by container -- docker: Error response from daemon: Conflict. The container name "/my_devops_toolkit" is already in use by container +- Fix by using anotehr name or delete the current container diff --git a/docs/usage/README.md b/docs/usage/README.md index 18f7a6b..48d639b 100644 --- a/docs/usage/README.md +++ b/docs/usage/README.md @@ -6,6 +6,10 @@ This guide us how to use the `devops-toolkit` with serveral usecases - Check [python_usage](./python_usage.md) +## Ansible + +- Check [ansible_usage](./ansible_usage.md) + ## Troubleshooting - For any issues, check [this document](../troubleshooting/TROUBLESHOOTING.md) diff --git a/docs/usage/ansible_usage.md b/docs/usage/ansible_usage.md new file mode 100644 index 0000000..d7c41e3 --- /dev/null +++ b/docs/usage/ansible_usage.md @@ -0,0 +1,41 @@ +# Use ansible 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 +``` + +## Use case 1: Run Ansible sample code provided in the container + +```bash +docker run --rm --network host -it devops-toolkit:latest + +# You now in the container terminal +ansible-playbook samples/ansible/check_os.yml +``` + +## Use case 2: Clone external code to container + +```bash +docker run --rm --network host -it devops-toolkit:latest +# You now in the container terminal + +# Now run your cloned script +cd ansible-examples +ansible-playbook +``` + +## Use case 3: Mount external code to container + +Clone the code to the host then mount to container + +```bash +# Clone code on the host +docker run --rm -v "$(pwd)":/root/ansible_workspace --network host -it devops-toolkit:latest +# Run the ansible code as usual +``` + +## Troubleshooting + +- For any issues, check [this reference](../troubleshooting/TROUBLESHOOTING.md) diff --git a/docs/usage/python_usage.md b/docs/usage/python_usage.md index e90798b..150bf80 100644 --- a/docs/usage/python_usage.md +++ b/docs/usage/python_usage.md @@ -3,26 +3,30 @@ To use the existing container isntead of creating one, use `docker exec` command instead of `docker run` ```bash +# Given that we have 'my_devops_toolkit' start before docker exec -it my_devops_toolkit /bin/bash ``` -## Run python sample code provided in the container +## Use case 1: 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 +docker run --rm --network host -it devops-toolkit:latest + # You now in the container terminal python3 samples/python/rectangle_area_calculator.py ``` -## Clone external code to container +## Use case 2: Clone external code to container ```bash -docker run --name my_devops_toolkit --network host -it devops-toolkit:latest +docker run --rm --network host -it devops-toolkit:latest # You now in the container terminal - # Clone code mkdir python_workspace cd python_workspace + +# Clone code +mkdir ansible_workspace +cd ansible_workspace git clone https://github.com/geekcomputers/Python.git # Now run your cloned script @@ -30,12 +34,15 @@ cd Python python3 Day_of_week.py ``` -## Mount external code to container +## Use case 3: 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 +docker run --rm -v "$(pwd)":/root/python_workspace --network host -it devops-toolkit:latest # Run the python code as usual ``` + +## Troubleshooting + +- For any issues, check [this reference](../troubleshooting/TROUBLESHOOTING.md)