Skip to content

Commit 65bd316

Browse files
authored
doc: python user guide (#111)
2 parents b9f1842 + d81134b commit 65bd316

File tree

5 files changed

+72
-6
lines changed

5 files changed

+72
-6
lines changed

README.md

+10
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,9 @@ chmod +x check_version_in_toolkit.sh
7171
```
7272

7373
## Use the official image from Docker Hub
74+
7475
DockerHub image [tungbq/devops-toolkit](https://hub.docker.com/r/tungbq/devops-toolkit)
76+
7577
```bash
7678
docker pull tungbq/devops-toolkit:latest
7779
```
@@ -101,15 +103,23 @@ docker run --rm devops-toolkit:latest ansible --version
101103
## Running Sample Tool Code Inside the Toolkit
102104

103105
Check out the full samples and instruction at [samples](./samples/)
106+
104107
- Run with default docker network
108+
105109
```bash
106110
docker run --rm devops-toolkit:latest samples/run_sample.sh
107111
```
112+
108113
- Run with host network
114+
109115
```bash
110116
docker run --network host --rm devops-toolkit:latest samples/run_sample.sh
111117
```
112118

119+
## User guide
120+
121+
- [DevOps toolkit user guide](./docs/usage/)
122+
113123
## The DevOps Toolkit Core
114124

115125
Built on `ubuntu:22.04` base image

docs/TROUBLESHOOTING.md

-6
This file was deleted.
+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Most common error
2+
3+
- <https://stackoverflow.com/questions/62154016/docker-on-wsl2-very-slow>
4+
5+
- exec /usr/local/bin/kubectl: exec format error
6+
See: <https://stackoverflow.com/questions/73398714/docker-fails-when-building-on-m1-macs-exec-usr-local-bin-docker-entrypoint-sh>
7+
8+
- Check architecure: dpkg --print-architecture
9+
10+
- docker: Error response from daemon: Conflict. The container name "/my_devops_toolkit" is already in use by container

docs/usage/README.md

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# The devops-toolkit usage
2+
3+
This guide us how to use the `devops-toolkit` with serveral usecases
4+
5+
## Python
6+
7+
- Check [python_usage](./python_usage.md)
8+
9+
## Troubleshooting
10+
11+
- For any issues, check [this document](../troubleshooting/TROUBLESHOOTING.md)

docs/usage/python_usage.md

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Use python in the devops-toolkit
2+
3+
To use the existing container isntead of creating one, use `docker exec` command instead of `docker run`
4+
5+
```bash
6+
docker exec -it my_devops_toolkit /bin/bash
7+
```
8+
9+
## Run python sample code provided in the container
10+
11+
```bash
12+
docker run --name my_devops_toolkit --network host -it devops-toolkit:latest
13+
# You now in the container terminal
14+
python3 samples/python/rectangle_area_calculator.py
15+
```
16+
17+
## Clone external code to container
18+
19+
```bash
20+
docker run --name my_devops_toolkit --network host -it devops-toolkit:latest
21+
# You now in the container terminal
22+
23+
# Clone code
24+
mkdir python_workspace
25+
cd python_workspace
26+
git clone https://github.com/geekcomputers/Python.git
27+
28+
# Now run your cloned script
29+
cd Python
30+
python3 Day_of_week.py
31+
```
32+
33+
## Mount external code to container
34+
35+
Clone the code to the host then mount to container
36+
37+
```bash
38+
# Clone code on the host
39+
docker run --name my_devops_toolkit -v "$(pwd)":/root/python_workspace --network host -it devops-toolkit:latest
40+
# Run the python code as usual
41+
```

0 commit comments

Comments
 (0)