Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doc: python user guide #111

Merged
merged 3 commits into from
Mar 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
```
Expand Down Expand Up @@ -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
Expand Down
6 changes: 0 additions & 6 deletions docs/TROUBLESHOOTING.md

This file was deleted.

10 changes: 10 additions & 0 deletions docs/troubleshooting/TROUBLESHOOTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Most common error

- <https://stackoverflow.com/questions/62154016/docker-on-wsl2-very-slow>

- 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>

- Check architecure: dpkg --print-architecture

- docker: Error response from daemon: Conflict. The container name "/my_devops_toolkit" is already in use by container
11 changes: 11 additions & 0 deletions docs/usage/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# The devops-toolkit usage

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)
41 changes: 41 additions & 0 deletions docs/usage/python_usage.md
Original file line number Diff line number Diff line change
@@ -0,0 +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
```
Loading