Update index.html
Browse files- index.html +182 -306
index.html
CHANGED
@@ -1,39 +1,36 @@
|
|
1 |
<!DOCTYPE html>
|
2 |
<html lang="en">
|
3 |
<head>
|
4 |
-
<meta charset="UTF-8"
|
5 |
<title>Concept to Code Millionaire</title>
|
6 |
-
<script src="https://cdn.tailwindcss.com"></script>
|
7 |
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
|
8 |
</head>
|
9 |
<body class="bg-gray-100 min-h-screen flex items-center justify-center p-6">
|
10 |
<div class="bg-white p-8 rounded-2xl shadow-xl w-full max-w-2xl">
|
11 |
<h1 class="text-4xl font-bold text-indigo-600 text-center mb-2">Concept to Code Millionaire</h1>
|
12 |
<p class="text-center text-sm text-gray-500 mb-6">
|
13 |
-
|
14 |
-
<a
|
15 |
-
|
16 |
-
class="underline hover:text-indigo-700">
|
17 |
Docker: From Concept to Commands — Michael Lively (Aug 23, 2025)
|
18 |
</a>
|
19 |
</p>
|
20 |
|
21 |
<div id="board">
|
|
|
22 |
<div id="question" class="text-2xl font-semibold text-gray-800 mb-4"></div>
|
23 |
<div id="choices" class="space-y-3"></div>
|
|
|
24 |
<div id="lifelines" class="flex justify-around mt-6">
|
25 |
-
<button id="life5050" class="lifeline bg-yellow-400 hover:bg-yellow-500 text-white font-medium py-2 px-4 rounded-lg shadow">
|
26 |
-
|
27 |
-
</button>
|
28 |
-
<button id="lifePoll" class="lifeline bg-blue-400 hover:bg-blue-500 text-white font-medium py-2 px-4 rounded-lg shadow">
|
29 |
-
Ask the Class
|
30 |
-
</button>
|
31 |
-
<button id="lifeHint" class="lifeline bg-green-400 hover:bg-green-500 text-white font-medium py-2 px-4 rounded-lg shadow">
|
32 |
-
Ask an Expert
|
33 |
-
</button>
|
34 |
</div>
|
|
|
35 |
<div id="poll" class="text-sm text-gray-700 mt-4"></div>
|
36 |
<div id="hint" class="text-sm italic text-gray-600 mt-2"></div>
|
|
|
37 |
<button id="next" class="hidden mt-8 bg-indigo-600 hover:bg-indigo-700 text-white font-semibold py-2 px-6 rounded-lg shadow">
|
38 |
Next Question
|
39 |
</button>
|
@@ -41,309 +38,188 @@
|
|
41 |
</div>
|
42 |
|
43 |
<script>
|
44 |
-
|
45 |
-
const
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
"\"It works on my machine\" problem",
|
51 |
-
"Vendor lock-in of cloud credits",
|
52 |
-
"I/O bottlenecks from HDDs"
|
53 |
-
],
|
54 |
-
correct: 1,
|
55 |
-
hint: "The article calls this out explicitly as a dreaded phrase."
|
56 |
-
},
|
57 |
-
{
|
58 |
-
q: "Which single command verifies a fresh Docker install by running a tiny test image?",
|
59 |
-
choices: [
|
60 |
-
"docker info",
|
61 |
-
"docker run hello-world",
|
62 |
-
"docker version",
|
63 |
-
"docker verify install"
|
64 |
-
],
|
65 |
-
correct: 1,
|
66 |
-
hint: "It both pulls and runs a simple image."
|
67 |
-
},
|
68 |
-
{
|
69 |
-
q: "Which statement best describes a Docker image vs. a container?",
|
70 |
-
choices: [
|
71 |
-
"Image is the running process; container is the template",
|
72 |
-
"Image is a blueprint; container is a running instance",
|
73 |
-
"Both are the same thing",
|
74 |
-
"Container builds images automatically"
|
75 |
-
],
|
76 |
-
correct: 1,
|
77 |
-
hint: "Blueprint vs. instance."
|
78 |
-
},
|
79 |
-
{
|
80 |
-
q: "Which pairing lists Docker’s foundational components correctly?",
|
81 |
-
choices: [
|
82 |
-
"Daemon (dockerd) and Client (CLI)",
|
83 |
-
"Supervisor and Operator",
|
84 |
-
"Scheduler and Controller",
|
85 |
-
"Planner and Runner"
|
86 |
-
],
|
87 |
-
correct: 0,
|
88 |
-
hint: "One runs on the host managing objects; one is your command tool."
|
89 |
-
},
|
90 |
-
{
|
91 |
-
q: "On Windows/macOS, which package bundles the daemon, CLI, and helpful tooling?",
|
92 |
-
choices: [
|
93 |
-
"Docker Desktop",
|
94 |
-
"Docker Studio",
|
95 |
-
"Docker Workstation",
|
96 |
-
"Docker Hub Client"
|
97 |
-
],
|
98 |
-
correct: 0,
|
99 |
-
hint: "It’s the standard local install for devs."
|
100 |
-
},
|
101 |
-
{
|
102 |
-
q: "Which registry is highlighted as the most well-known public repository for images?",
|
103 |
-
choices: [
|
104 |
-
"Artifact Registry",
|
105 |
-
"Docker Hub",
|
106 |
-
"Harbor",
|
107 |
-
"Quay"
|
108 |
-
],
|
109 |
-
correct: 1,
|
110 |
-
hint: "It’s the default source used by many docker pull commands."
|
111 |
-
},
|
112 |
-
{
|
113 |
-
q: "Which two commands run Nginx locally and map container port 80 to host 8080?",
|
114 |
-
choices: [
|
115 |
-
"docker pull nginx && docker run -d -p 8080:80 nginx",
|
116 |
-
"docker build nginx && docker start -p 8080:80 nginx",
|
117 |
-
"docker fetch nginx && docker exec -p 8080:80 nginx",
|
118 |
-
"docker clone nginx && docker up -p 8080:80"
|
119 |
-
],
|
120 |
-
correct: 0,
|
121 |
-
hint: "First pull, then run detached with -p host:container."
|
122 |
-
},
|
123 |
-
{
|
124 |
-
q: "In a typical Docker development flow, which file defines how to build your image?",
|
125 |
-
choices: [
|
126 |
-
"compose.yaml",
|
127 |
-
"Dockerfile",
|
128 |
-
"package.json",
|
129 |
-
"Container.toml"
|
130 |
-
],
|
131 |
-
correct: 1,
|
132 |
-
hint: "It’s a plain text set of build instructions."
|
133 |
-
},
|
134 |
-
{
|
135 |
-
q: "Which docker build/run pair correctly tags and launches an app on port 5000?",
|
136 |
-
choices: [
|
137 |
-
"docker build -t myapp:1.0 . && docker run -d -p 5000:5000 myapp:1.0",
|
138 |
-
"docker build myapp . && docker start -p 5000:5000 myapp",
|
139 |
-
"docker compile -t myapp . && docker exec -p 5000 myapp",
|
140 |
-
"docker make -t myapp . && docker deploy -p 5000 myapp"
|
141 |
-
],
|
142 |
-
correct: 0,
|
143 |
-
hint: "Tag with -t, then run detached with -p host:container."
|
144 |
-
},
|
145 |
-
{
|
146 |
-
q: "Which command set focuses on day-to-day container lifecycle operations?",
|
147 |
-
choices: [
|
148 |
-
"docker ps, docker stop, docker rm, docker logs",
|
149 |
-
"docker get, docker halt, docker purge, docker read",
|
150 |
-
"docker view, docker end, docker delete, docker cat",
|
151 |
-
"docker list, docker kill, docker trash, docker echo"
|
152 |
-
],
|
153 |
-
correct: 0,
|
154 |
-
hint: "These are the canonical verbs shown in the article."
|
155 |
-
},
|
156 |
-
{
|
157 |
-
q: "What’s a recommended practice for keeping images small and efficient?",
|
158 |
-
choices: [
|
159 |
-
"Install all dev tools into the final image",
|
160 |
-
"Use multi-stage builds and small base images (e.g., alpine)",
|
161 |
-
"Bundle multiple apps in one container",
|
162 |
-
"Avoid .dockerignore to include everything"
|
163 |
-
],
|
164 |
-
correct: 1,
|
165 |
-
hint: "Less is more—stage builds and tiny bases."
|
166 |
-
},
|
167 |
-
{
|
168 |
-
q: "Which command safely reclaims disk by removing all unused images?",
|
169 |
-
choices: [
|
170 |
-
"docker image prune -a",
|
171 |
-
"docker images --rm all",
|
172 |
-
"docker clean images",
|
173 |
-
"docker rmi --unused"
|
174 |
-
],
|
175 |
-
correct: 0,
|
176 |
-
hint: "Prune is the keyword."
|
177 |
-
},
|
178 |
-
{
|
179 |
-
q: "What’s the simplest way to cluster Docker for small projects using built-in tooling?",
|
180 |
-
choices: [
|
181 |
-
"Enable Swarm with docker swarm init",
|
182 |
-
"Install Kubernetes the hard way",
|
183 |
-
"Write a custom scheduler",
|
184 |
-
"Use a systemd unit file"
|
185 |
-
],
|
186 |
-
correct: 0,
|
187 |
-
hint: "Built into Docker itself."
|
188 |
-
},
|
189 |
-
{
|
190 |
-
q: "Which statement best captures Swarm vs. Kubernetes in the article?",
|
191 |
-
choices: [
|
192 |
-
"Swarm is feature-richer than Kubernetes for enterprises",
|
193 |
-
"Kubernetes is the de facto standard for large-scale orchestration",
|
194 |
-
"Both are equally adopted in production",
|
195 |
-
"Swarm has a larger ecosystem than Kubernetes"
|
196 |
-
],
|
197 |
-
correct: 1,
|
198 |
-
hint: "Think industry adoption and ecosystem."
|
199 |
-
},
|
200 |
-
{
|
201 |
-
q: "Which Kubernetes command sequence mirrors the article’s quick start?",
|
202 |
-
choices: [
|
203 |
-
"minikube start → kubectl create deployment nginx --image=nginx → kubectl expose deployment nginx --port=80 --type=NodePort",
|
204 |
-
"kubeadm up → kctl make deploy nginx → kctl service open 80",
|
205 |
-
"kubestart → kubectl add nginx → kubectl publish 80",
|
206 |
-
"kind boot → kubectl run nginx --image=nginx → kubectl open service 80"
|
207 |
-
],
|
208 |
-
correct: 0,
|
209 |
-
hint: "Minikube, create deployment, then expose with NodePort."
|
210 |
-
}
|
211 |
-
];
|
212 |
-
|
213 |
-
const prizes = [100,200,300,500,1000,2000,4000,8000,16000,32000,64000,125000,250000,500000,1000000];
|
214 |
-
let idx = 0;
|
215 |
-
let currentPrize = prizes[0];
|
216 |
-
|
217 |
-
// Evenly distribute correct answers across A–D
|
218 |
-
questions.forEach((q, i) => {
|
219 |
-
const target = i % 4; // 0=A,1=B,2=C,3=D pattern
|
220 |
-
if (q.correct !== target) {
|
221 |
-
[q.choices[target], q.choices[q.correct]] = [q.choices[q.correct], q.choices[target]];
|
222 |
-
q.correct = target;
|
223 |
-
}
|
224 |
-
});
|
225 |
-
|
226 |
-
const qEl = document.getElementById('question');
|
227 |
-
const cEl = document.getElementById('choices');
|
228 |
-
const pollEl = document.getElementById('poll');
|
229 |
-
const hintEl = document.getElementById('hint');
|
230 |
-
const nextBtn = document.getElementById('next');
|
231 |
-
const boardEl = document.getElementById('board');
|
232 |
-
|
233 |
-
function updateQuestionDisplay() {
|
234 |
-
qEl.textContent = `$${currentPrize}: ${questions[idx].q}`;
|
235 |
-
}
|
236 |
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
242 |
});
|
243 |
-
pollEl.textContent = '';
|
244 |
-
hintEl.textContent = '';
|
245 |
-
nextBtn.classList.add('hidden');
|
246 |
|
247 |
-
|
248 |
-
|
|
|
249 |
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
|
|
255 |
|
256 |
-
|
257 |
-
|
258 |
-
btn.onclick = selectAnswer;
|
259 |
-
});
|
260 |
-
}
|
261 |
-
|
262 |
-
function selectAnswer(e) {
|
263 |
-
const chosen = +e.target.dataset.i;
|
264 |
-
const corr = questions[idx].correct;
|
265 |
-
document.querySelectorAll('.choice').forEach(b => b.disabled = true);
|
266 |
-
|
267 |
-
if (chosen === corr) {
|
268 |
-
e.target.classList.replace('bg-indigo-500','bg-green-500');
|
269 |
-
} else {
|
270 |
-
e.target.classList.replace('bg-indigo-500','bg-red-500');
|
271 |
-
const correctBtn = document.querySelector(\`.choice[data-i="\${corr}"]\`);
|
272 |
-
if (correctBtn) correctBtn.classList.replace('bg-indigo-500','bg-green-500');
|
273 |
}
|
274 |
-
nextBtn.classList.remove('hidden');
|
275 |
-
}
|
276 |
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
const corr = questions[idx].correct;
|
285 |
-
questions[idx].choices
|
286 |
-
.map((_, i) => i)
|
287 |
-
.filter(i => i !== corr)
|
288 |
-
.sort(() => Math.random() - 0.5)
|
289 |
-
.slice(0, 2)
|
290 |
-
.forEach(i => {
|
291 |
-
const b = document.querySelector(\`.choice[data-i="\${i}"]\`);
|
292 |
-
if (b) {
|
293 |
-
b.disabled = true;
|
294 |
-
b.classList.add('opacity-50');
|
295 |
-
}
|
296 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
297 |
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
pct[corr] = 70 + Math.floor(Math.random() * 21); // 70–90% on correct
|
313 |
-
let rem = 100 - pct[corr];
|
314 |
-
|
315 |
-
const others = [0,1,2,3].filter(i => i !== corr);
|
316 |
-
others.forEach((i, j) => {
|
317 |
-
const last = j === others.length - 1;
|
318 |
-
const alloc = last ? rem : Math.floor(rem / (others.length - j));
|
319 |
-
pct[i] = alloc;
|
320 |
-
rem -= alloc;
|
321 |
-
});
|
322 |
-
|
323 |
-
pollEl.textContent = `Class Poll: A:${pct[0]}% B:${pct[1]}% C:${pct[2]}% D:${pct[3]}%`;
|
324 |
-
};
|
325 |
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
btn.classList.add('opacity-50');
|
332 |
-
hintEl.textContent = `Expert Hint: ${questions[idx].hint}`;
|
333 |
-
};
|
334 |
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
} else {
|
341 |
-
boardEl.innerHTML = '<div class="text-3xl font-bold text-green-600 text-center">🎉 Congratulations! You’ve mastered Concept to Code Millionaire! 🎉</div>';
|
342 |
-
}
|
343 |
-
};
|
344 |
|
345 |
-
|
346 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
347 |
</script>
|
348 |
</body>
|
349 |
</html>
|
|
|
1 |
<!DOCTYPE html>
|
2 |
<html lang="en">
|
3 |
<head>
|
4 |
+
<meta charset="UTF-8" />
|
5 |
<title>Concept to Code Millionaire</title>
|
|
|
6 |
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
7 |
+
<script src="https://cdn.tailwindcss.com"></script>
|
8 |
</head>
|
9 |
<body class="bg-gray-100 min-h-screen flex items-center justify-center p-6">
|
10 |
<div class="bg-white p-8 rounded-2xl shadow-xl w-full max-w-2xl">
|
11 |
<h1 class="text-4xl font-bold text-indigo-600 text-center mb-2">Concept to Code Millionaire</h1>
|
12 |
<p class="text-center text-sm text-gray-500 mb-6">
|
13 |
+
Source:
|
14 |
+
<a class="underline hover:text-indigo-700" target="_blank"
|
15 |
+
href="https://www.linkedin.com/pulse/docker-from-concept-commands-michael-lively-mndwe/">
|
|
|
16 |
Docker: From Concept to Commands — Michael Lively (Aug 23, 2025)
|
17 |
</a>
|
18 |
</p>
|
19 |
|
20 |
<div id="board">
|
21 |
+
<div id="error" class="hidden mb-3 text-sm text-red-600 bg-red-50 border border-red-200 rounded p-2"></div>
|
22 |
<div id="question" class="text-2xl font-semibold text-gray-800 mb-4"></div>
|
23 |
<div id="choices" class="space-y-3"></div>
|
24 |
+
|
25 |
<div id="lifelines" class="flex justify-around mt-6">
|
26 |
+
<button id="life5050" class="lifeline bg-yellow-400 hover:bg-yellow-500 text-white font-medium py-2 px-4 rounded-lg shadow">50:50</button>
|
27 |
+
<button id="lifePoll" class="lifeline bg-blue-400 hover:bg-blue-500 text-white font-medium py-2 px-4 rounded-lg shadow">Ask the Class</button>
|
28 |
+
<button id="lifeHint" class="lifeline bg-green-400 hover:bg-green-500 text-white font-medium py-2 px-4 rounded-lg shadow">Ask an Expert</button>
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
</div>
|
30 |
+
|
31 |
<div id="poll" class="text-sm text-gray-700 mt-4"></div>
|
32 |
<div id="hint" class="text-sm italic text-gray-600 mt-2"></div>
|
33 |
+
|
34 |
<button id="next" class="hidden mt-8 bg-indigo-600 hover:bg-indigo-700 text-white font-semibold py-2 px-6 rounded-lg shadow">
|
35 |
Next Question
|
36 |
</button>
|
|
|
38 |
</div>
|
39 |
|
40 |
<script>
|
41 |
+
window.addEventListener('DOMContentLoaded', () => {
|
42 |
+
const showError = (msg) => {
|
43 |
+
const el = document.getElementById('error');
|
44 |
+
el.textContent = msg;
|
45 |
+
el.classList.remove('hidden');
|
46 |
+
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
47 |
|
48 |
+
try {
|
49 |
+
const questions = [
|
50 |
+
{ q: "What core problem does Docker reduce by packaging apps with all dependencies?",
|
51 |
+
choices: ["\"My CPU is too slow\" problem","\"It works on my machine\" problem","Vendor lock-in of cloud credits","I/O bottlenecks from HDDs"],
|
52 |
+
correct: 1, hint: "Called out explicitly as a dreaded phrase." },
|
53 |
+
{ q: "Which command verifies a fresh Docker install with a tiny test image?",
|
54 |
+
choices: ["docker info","docker run hello-world","docker version","docker verify install"],
|
55 |
+
correct: 1, hint: "It both pulls and runs a simple image." },
|
56 |
+
{ q: "Best description of image vs. container?",
|
57 |
+
choices: ["Image is the running process; container is the template","Image is a blueprint; container is a running instance","Both are the same","Container builds images automatically"],
|
58 |
+
correct: 1, hint: "Blueprint vs. instance." },
|
59 |
+
{ q: "Which pairing lists Docker’s foundational components?",
|
60 |
+
choices: ["Daemon (dockerd) and Client (CLI)","Supervisor and Operator","Scheduler and Controller","Planner and Runner"],
|
61 |
+
correct: 0, hint: "One manages objects; one is your command tool." },
|
62 |
+
{ q: "On Windows/macOS, which bundle includes daemon, CLI, and tools?",
|
63 |
+
choices: ["Docker Desktop","Docker Studio","Docker Workstation","Docker Hub Client"],
|
64 |
+
correct: 0, hint: "Standard local install for devs." },
|
65 |
+
{ q: "Most well-known public image registry?",
|
66 |
+
choices: ["Artifact Registry","Docker Hub","Harbor","Quay"],
|
67 |
+
correct: 1, hint: "Default source for many pulls." },
|
68 |
+
{ q: "Which pair runs Nginx and maps 80→8080 on host?",
|
69 |
+
choices: ["docker pull nginx && docker run -d -p 8080:80 nginx","docker build nginx && docker start -p 8080:80 nginx","docker fetch nginx && docker exec -p 8080:80 nginx","docker clone nginx && docker up -p 8080:80"],
|
70 |
+
correct: 0, hint: "Pull, then run detached with -p host:container." },
|
71 |
+
{ q: "Which file defines how to build your image?",
|
72 |
+
choices: ["compose.yaml","Dockerfile","package.json","Container.toml"],
|
73 |
+
correct: 1, hint: "Plain text build instructions." },
|
74 |
+
{ q: "Which build/run pair tags and launches on port 5000?",
|
75 |
+
choices: ["docker build -t myapp:1.0 . && docker run -d -p 5000:5000 myapp:1.0","docker build myapp . && docker start -p 5000:5000 myapp","docker compile -t myapp . && docker exec -p 5000 myapp","docker make -t myapp . && docker deploy -p 5000 myapp"],
|
76 |
+
correct: 0, hint: "Tag with -t, run with -p host:container." },
|
77 |
+
{ q: "Day-to-day container lifecycle commands?",
|
78 |
+
choices: ["docker ps, docker stop, docker rm, docker logs","docker get, docker halt, docker purge, docker read","docker view, docker end, docker delete, docker cat","docker list, docker kill, docker trash, docker echo"],
|
79 |
+
correct: 0, hint: "Canonical verbs in the article." },
|
80 |
+
{ q: "Keep images small and efficient by…",
|
81 |
+
choices: ["Installing all dev tools in final image","Using multi-stage builds and small bases (e.g., alpine)","Bundling multiple apps per container","Avoiding .dockerignore"],
|
82 |
+
correct: 1, hint: "Less is more." },
|
83 |
+
{ q: "Reclaim disk by removing unused images:",
|
84 |
+
choices: ["docker image prune -a","docker images --rm all","docker clean images","docker rmi --unused"],
|
85 |
+
correct: 0, hint: "Prune is the key." },
|
86 |
+
{ q: "Simplest built-in clustering for small projects:",
|
87 |
+
choices: ["Enable Swarm with docker swarm init","Install Kubernetes the hard way","Write a custom scheduler","Use a systemd unit file"],
|
88 |
+
correct: 0, hint: "Built into Docker." },
|
89 |
+
{ q: "Swarm vs. Kubernetes — best summary:",
|
90 |
+
choices: ["Swarm is richer for enterprises","Kubernetes is the de facto standard for large-scale orchestration","Equal production adoption","Swarm has the larger ecosystem"],
|
91 |
+
correct: 1, hint: "Think ecosystem and adoption." },
|
92 |
+
{ q: "Kubernetes quick start sequence from the article:",
|
93 |
+
choices: ["minikube start → kubectl create deployment nginx --image=nginx → kubectl expose deployment nginx --port=80 --type=NodePort",
|
94 |
+
"kubeadm up → kctl make deploy nginx → kctl service open 80",
|
95 |
+
"kubestart → kubectl add nginx → kubectl publish 80",
|
96 |
+
"kind boot → kubectl run nginx --image=nginx → kubectl open service 80"],
|
97 |
+
correct: 0, hint: "Minikube, create deployment, expose NodePort." }
|
98 |
+
];
|
99 |
+
|
100 |
+
// Evenly redistribute correct answers across A–D
|
101 |
+
questions.forEach((q, i) => {
|
102 |
+
const target = i % 4; // 0=A,1=B,2=C,3=D
|
103 |
+
if (q.correct !== target) {
|
104 |
+
[q.choices[target], q.choices[q.correct]] = [q.choices[q.correct], q.choices[target]];
|
105 |
+
q.correct = target;
|
106 |
+
}
|
107 |
});
|
|
|
|
|
|
|
108 |
|
109 |
+
const prizes = [100,200,300,500,1000,2000,4000,8000,16000,32000,64000,125000,250000,500000,1000000];
|
110 |
+
let idx = 0;
|
111 |
+
let currentPrize = prizes[0];
|
112 |
|
113 |
+
const qEl = document.getElementById('question');
|
114 |
+
const cEl = document.getElementById('choices');
|
115 |
+
const pollEl = document.getElementById('poll');
|
116 |
+
const hintEl = document.getElementById('hint');
|
117 |
+
const nextBtn = document.getElementById('next');
|
118 |
+
const boardEl = document.getElementById('board');
|
119 |
|
120 |
+
function updateQuestionDisplay() {
|
121 |
+
qEl.textContent = `$${currentPrize}: ${questions[idx].q}`;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
122 |
}
|
|
|
|
|
123 |
|
124 |
+
function showQuestion() {
|
125 |
+
// Reset lifelines
|
126 |
+
['life5050','lifePoll','lifeHint'].forEach(id => {
|
127 |
+
const btn = document.getElementById(id);
|
128 |
+
btn.disabled = false;
|
129 |
+
btn.classList.remove('opacity-50');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
130 |
});
|
131 |
+
document.getElementById('error').classList.add('hidden');
|
132 |
+
pollEl.textContent = '';
|
133 |
+
hintEl.textContent = '';
|
134 |
+
nextBtn.classList.add('hidden');
|
135 |
+
|
136 |
+
currentPrize = prizes[idx];
|
137 |
+
updateQuestionDisplay();
|
138 |
+
|
139 |
+
cEl.innerHTML = questions[idx].choices.map((ch,i) =>
|
140 |
+
`<button class="choice bg-indigo-500 hover:bg-indigo-600 text-white font-medium py-2 px-4 rounded w-full" data-i="${i}">
|
141 |
+
${String.fromCharCode(65+i)}. ${ch}
|
142 |
+
</button>`
|
143 |
+
).join('');
|
144 |
+
|
145 |
+
document.querySelectorAll('.choice').forEach(btn => {
|
146 |
+
btn.disabled = false;
|
147 |
+
btn.onclick = selectAnswer;
|
148 |
+
});
|
149 |
+
}
|
150 |
|
151 |
+
function selectAnswer(e) {
|
152 |
+
const chosen = +e.currentTarget.dataset.i;
|
153 |
+
const corr = questions[idx].correct;
|
154 |
+
document.querySelectorAll('.choice').forEach(b => b.disabled = true);
|
155 |
+
|
156 |
+
if (chosen === corr) {
|
157 |
+
e.currentTarget.classList.replace('bg-indigo-500','bg-green-500');
|
158 |
+
} else {
|
159 |
+
e.currentTarget.classList.replace('bg-indigo-500','bg-red-500');
|
160 |
+
const correctBtn = document.querySelector(`.choice[data-i="${corr}"]`);
|
161 |
+
if (correctBtn) correctBtn.classList.replace('bg-indigo-500','bg-green-500');
|
162 |
+
}
|
163 |
+
nextBtn.classList.remove('hidden');
|
164 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
165 |
|
166 |
+
// Lifelines
|
167 |
+
document.getElementById('life5050').onclick = () => {
|
168 |
+
const btn = document.getElementById('life5050');
|
169 |
+
if (btn.disabled) return;
|
170 |
+
btn.disabled = true; btn.classList.add('opacity-50');
|
|
|
|
|
|
|
171 |
|
172 |
+
const corr = questions[idx].correct;
|
173 |
+
[0,1,2,3].filter(i => i !== corr).sort(() => Math.random()-0.5).slice(0,2).forEach(i => {
|
174 |
+
const b = document.querySelector(`.choice[data-i="${i}"]`);
|
175 |
+
if (b) { b.disabled = true; b.classList.add('opacity-50'); }
|
176 |
+
});
|
|
|
|
|
|
|
|
|
177 |
|
178 |
+
currentPrize = Math.floor(currentPrize / 2);
|
179 |
+
updateQuestionDisplay();
|
180 |
+
};
|
181 |
+
|
182 |
+
document.getElementById('lifePoll').onclick = () => {
|
183 |
+
const btn = document.getElementById('lifePoll');
|
184 |
+
if (btn.disabled) return;
|
185 |
+
btn.disabled = true; btn.classList.add('opacity-50');
|
186 |
+
|
187 |
+
const corr = questions[idx].correct;
|
188 |
+
const pct = [0,0,0,0];
|
189 |
+
pct[corr] = 70 + Math.floor(Math.random() * 21);
|
190 |
+
let rem = 100 - pct[corr];
|
191 |
+
[0,1,2,3].filter(i => i !== corr).forEach((i,j,arr) => {
|
192 |
+
const last = j === arr.length - 1;
|
193 |
+
const alloc = last ? rem : Math.floor(rem / (arr.length - j));
|
194 |
+
pct[i] = alloc; rem -= alloc;
|
195 |
+
});
|
196 |
+
pollEl.textContent = `Class Poll: A:${pct[0]}% B:${pct[1]}% C:${pct[2]}% D:${pct[3]}%`;
|
197 |
+
};
|
198 |
+
|
199 |
+
document.getElementById('lifeHint').onclick = () => {
|
200 |
+
const btn = document.getElementById('lifeHint');
|
201 |
+
if (btn.disabled) return;
|
202 |
+
btn.disabled = true; btn.classList.add('opacity-50');
|
203 |
+
hintEl.textContent = `Expert Hint: ${questions[idx].hint}`;
|
204 |
+
};
|
205 |
+
|
206 |
+
nextBtn.onclick = () => {
|
207 |
+
idx++;
|
208 |
+
if (idx < questions.length) {
|
209 |
+
showQuestion();
|
210 |
+
} else {
|
211 |
+
boardEl.innerHTML = '<div class="text-3xl font-bold text-green-600 text-center">🎉 Congratulations! You’ve mastered Concept to Code Millionaire! 🎉</div>';
|
212 |
+
}
|
213 |
+
};
|
214 |
+
|
215 |
+
// Kickoff
|
216 |
+
showQuestion();
|
217 |
+
|
218 |
+
} catch (err) {
|
219 |
+
console.error(err);
|
220 |
+
showError("JavaScript error prevented the questions from rendering. Open the browser console for details.");
|
221 |
+
}
|
222 |
+
});
|
223 |
</script>
|
224 |
</body>
|
225 |
</html>
|