Skip to content

Commit 5c9cf3d

Browse files
committed
Update docs
1 parent d5b6ddd commit 5c9cf3d

File tree

5 files changed

+138
-7
lines changed

5 files changed

+138
-7
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
*.qcow2
2+
.vscode/settings.json

README.md

Lines changed: 106 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,130 @@
1-
# alpine-nested-qemu-docker
1+
# github-runner-nested-docker
2+
3+
This is a modified **alpine-nested-qemu-docker** for running **[myoung34/github-runner:ubuntu-jammy](https://github.com/myoung34/docker-github-actions-runner)** in a Docker container without privileged mode.
4+
5+
## How to ?
6+
7+
This is a sample Kubernetes manifest for deploying it:
8+
9+
```yaml
10+
---
11+
apiVersion: v1
12+
kind: Secret
13+
metadata:
14+
name: heartbeat
15+
namespace: sandbox-github-runner
16+
type: Opaque
17+
stringData:
18+
now: "19820002"
19+
---
20+
apiVersion: v1
21+
kind: ConfigMap
22+
metadata:
23+
name: entrypoint
24+
namespace: sandbox-github-runner
25+
data:
26+
entrypoint: |
27+
#!/bin/sh
28+
while (! docker stats --no-stream ); do
29+
# Docker takes a few seconds to initialize
30+
echo "Waiting for Docker to launch..."
31+
sleep $((`od -vAn -N2 -tu2 < /dev/urandom` %15))
32+
done
33+
docker run -e ACCESS_TOKEN=kfNKfcRR7rYAUebw31o= -e ORG_NAME=herokukms -e RUNNER_GROUP=Docker-runners -e RUNNER_SCOPE=org -e RUNNER_NAME_PREFIX=heroku -e TIMESTAMP=19820002 myoung34/github-runner:ubuntu-jammy
34+
---
35+
apiVersion: apps/v1
36+
#kind: Deployment
37+
kind: StatefulSet
38+
metadata:
39+
name: herokukms-runner
40+
namespace: sandbox-github-runner
41+
labels:
42+
app: herokukms-runner
43+
spec:
44+
replicas: 9
45+
#strategy:
46+
# type: Recreate
47+
selector:
48+
matchLabels:
49+
app: herokukms-runner
50+
template:
51+
metadata:
52+
labels:
53+
app: herokukms-runner
54+
spec:
55+
containers:
56+
- name: herokukms-runner
57+
image: herokukms/github-runner-nested:1.0.0
58+
volumeMounts:
59+
- name: entrypoint
60+
mountPath: /ext
61+
env:
62+
- name: ACCESS_TOKEN
63+
value: kfNKfcRR7rYAUebw31o=
64+
- name: ORG_NAME
65+
value: herokukms
66+
- name: RUNNER_GROUP
67+
value: Docker-runners
68+
- name: RUNNER_SCOPE
69+
value: org
70+
- name: TIMESTAMP
71+
value: "19820002"
72+
- name: RANDOM_RUNNER_SUFFIX
73+
value: "hostname"
74+
- name: QEMU_CPU
75+
value: "1"
76+
- name: QEMU_RAM
77+
value: "2048"
78+
- name: UPDATED
79+
value: "19820002"
80+
# securityContext:
81+
# privileged: true
82+
volumes:
83+
- name: entrypoint
84+
configMap:
85+
name: entrypoint
86+
defaultMode: 0777
87+
```
88+
89+
## alpine-nested-qemu-docker
90+
291
## Why this strange idea ?
92+
393
Because most of docker container can't run in a privileged environment and so cannot run Docker.
4-
This Docker image runs an Alpine linux in a QEMU virtual machine so the docker daemon runs like in a real machine.
94+
This Docker image runs an Alpine linux in a QEMU virtual machine so the docker daemon runs like in a real machine.
95+
96+
## How to
597
6-
# How to
798
```sh
899
docker run -it -v ./entrypoint:/ext/entrypoint eltorio/alpine-nested-qemu-docker
9100
```
101+
10102
`./entrypoint` is a mandatory shell script. It will be run after docker and ntpd services in the Alpine virtual machine
11103

12-
# Demo
104+
## Demo
105+
13106
For launching busybox:latest in the non privileged image:
107+
14108
```sh
15109
make build
16110
make demo
17111
```
18112

19-
# Connect to nested Alpine
113+
## Connect to nested Alpine
114+
20115
While connected to the qemu container you can reach the nested Alpine vm with
116+
21117
```sh
22118
telnet localhost
23119
```
120+
24121
hit enter and connect as root
25122
For leaving telnet hit CTRL+$ and quit
26123

27-
# Kubernetes sample deployement
124+
## Kubernetes sample deployement
125+
28126
This launch 10 replicas of busybox:latest on Kubernetes
127+
29128
```yaml
30129
---
31130
apiVersion: v1
@@ -83,4 +182,4 @@ spec:
83182
configMap:
84183
name: entrypoint
85184
defaultMode: 0777
86-
```
185+
```
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
U2FsdGVkX18EqgKXii0aiZ7cJd0aIpoCAme6mKwPmJczf0E9GUxOVcwhSkYeY3tP
2+
mOQh3Ij3r8Cqal8068UhgqH4deefgebiAIdcVVhN74rb54zMxRQyUaki/wDCL1gl
3+
KljsyGKVLJr3lsZH2pfbOVFD8ThI1YNelbe2vYJkIFBCWwG9n4aFnLD81GBoyl/6
4+
4SdRpbJaUFl+YyLDP7VOW9VkXtmluC7pGmUbQ3uS3UJ3gnqbHPXaHyi6PRbMwAZX
5+
Btp79OOHSWw6TX+8svNEjpHdDXtWUW2Uy6ZMnEcmyBylqUj58G+iVMHgtSKQLy+r
6+
eMhJDJXIXvWAl3obtl73THhAnJLnXYhBa5JYEi9R65m5jgW6l/8FycxkgJXEhBrS
7+
mvq5YVsG9bG3G9YEV5GIDJ8rJEOJlQsJPCL6eSdLzeqBfRA0MrHN1keEkqHH/Q1f
8+
1+PRH8bnnLz77R+E4xKO9/u4OGanm9p5Ytu05r5IosM4Elr80kyxfKbIXdpyyOGI
9+
fnCYrkyF/E7XlYEvg6Ar0Xx46FXrwaF6kQsfWLe3Ia661ifr7ZaHB6r3PyYZ+/T7
10+
WsmnRc5GB7XK0f5dLq/8/R3J4usT3flQh6hcwfi4W98=
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/bin/sh
2+
echo "If you restore for a cloned repo you may declare a PROJECT_ROOT environment variable before running this"
3+
read -p "Press any key to continue... " -n1 -s
4+
cd $PROJECT_ROOT
5+
#1-decrypt
6+
openssl aes-256-cbc -a -d -md sha256 -in _sensitive_datas/_sensitive_datas.tar.xz.enc -out _sensitive_datas/_sensitive_datas.tar.xz
7+
#2-show content
8+
echo "++++++++++++++++++++++++++++++++++++++++++++++++++"
9+
echo "_sensitive_datas/_sensitive_datas.tar.xz contains:"
10+
tar -tvJf _sensitive_datas/_sensitive_datas.tar.xz
11+
#3 show help
12+
echo "if you want to restore enter:"
13+
echo "cd $PROJECT_ROOT && tar -xvJf _sensitive_datas/_sensitive_datas.tar.xz"
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/bin/bash
2+
#1-store
3+
cd "$PROJECT_ROOT" || exit
4+
tar -cvJf _sensitive_datas/_sensitive_datas.tar.xz .vscode/launch.json .vscode/settings.json ./launch-* ./*.pem ./*.key .wrangler/ crowdin.yml
5+
#2-encrypt
6+
openssl aes-256-cbc -base64 -md sha256 -in _sensitive_datas/_sensitive_datas.tar.xz -out _sensitive_datas/_sensitive_datas.tar.xz.enc
7+
#3-delete
8+
rm _sensitive_datas/_sensitive_datas.tar.xz

0 commit comments

Comments
 (0)