Skip to content

DevOps, Git & Tools

Q (basic): What is Docker and why use it?

Say this (30 sec): Docker packages an app with its runtime, libraries, and config into an image that runs the same everywhere. That fixes “it works on my machine”. Containers are isolated processes that share the host’s kernel, using Linux namespaces for isolation and cgroups for resource limits. That makes them much lighter and faster to start than VMs.

Follow-ups they ask: “Container vs VM?” A VM virtualizes the hardware and runs a full guest OS, which is heavy. A container virtualizes at the OS level and shares the host kernel, so it’s light and starts in seconds.

Q (basic): Image vs container?

Say this: An image is an immutable, layered template (like a class). A container is a running instance of it (like an object), with a thin writable layer on top. One image can run many containers. Data written inside a container is lost when the container is removed, unless you use a volume.

Q (mid): How do Dockerfile layers and caching work?

Say this (30 sec): Each instruction (FROM, RUN, COPY, …) creates a layer, and layers are cached. If a layer changes, every layer after it is rebuilt. So put things that rarely change first: copy package.json and the lockfile, install dependencies, and then copy the source. Changing code then doesn’t reinstall node_modules. Add a .dockerignore for node_modules, .git, and .env.

Example:

FROM node:22-alpine
WORKDIR /app
COPY package*.json ./
RUN npm ci --omit=dev
COPY . .
EXPOSE 3000
USER node
CMD ["node", "src/index.js"]
Q (mid): What are multi-stage builds?

Say this: You use several FROM stages in one Dockerfile. Build in a large image that has dev dependencies and compilers, then copy only the output into a small runtime image. The result is a smaller image, a faster deploy, and less attack surface, because no build tools or source maps ship.

Example:

FROM node:22-alpine AS build
WORKDIR /app
COPY package*.json ./
RUN npm ci
COPY . .
RUN npm run build
FROM node:22-alpine
WORKDIR /app
COPY package*.json ./
RUN npm ci --omit=dev
COPY --from=build /app/dist ./dist
USER node
CMD ["node", "dist/index.js"]
Q (mid): CMD vs ENTRYPOINT? COPY vs ADD?

Say this: ENTRYPOINT sets the executable that always runs. CMD gives default arguments, or a default command, which docker run image <args> can override. Use the exec form ["node","app.js"] so the process is PID 1 and receives signals like SIGTERM. COPY just copies files. ADD can also extract tarballs and fetch URLs. Prefer COPY.

Q (mid): Volumes vs bind mounts?

Say this: A volume is managed by Docker (docker volume create). It persists after containers are removed, and it’s best for DB data. A bind mount maps a host folder into the container (-v $(pwd):/app). It’s great for local development with hot reload. Both persist data outside the container’s writable layer.

Q (basic): What is Docker Compose?

Say this: It defines multi-container apps in one YAML file (e.g. api, postgres, redis) with ports, env, volumes, and networks. docker compose up -d starts everything. Services reach each other by service name on the default network: the API connects to postgres:5432, not localhost.

Example:

services:
api:
build: .
ports: ["3000:3000"]
env_file: .env
depends_on: [db]
db:
image: postgres:16
environment:
POSTGRES_PASSWORD: example
volumes: ["pgdata:/var/lib/postgresql/data"]
volumes:
pgdata:

Common wrong answer: Using localhost to reach another container. Inside a container, localhost is that container itself.

Q (basic): Common Docker commands?

Say this: docker build -t app ., docker run -d -p 3000:3000 --name api app, docker ps (-a for all), docker logs -f api, docker exec -it api sh, docker stop / docker rm, docker images, docker rmi, and docker system prune.

Q (basic): What is CI/CD?

Say this (30 sec): Continuous Integration: on every push or PR, automatically install, lint, type-check, test, and build, so problems are caught early. Continuous Delivery: every passing build is ready to deploy, but a person approves the release. Continuous Deployment: it deploys automatically. Tools: GitHub Actions, GitLab CI, Jenkins. For Workers, wrangler deploy runs in a GitHub Action, or you use Cloudflare’s Git integration.

Example:

on: [push, pull_request]
jobs:
ci:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with: { node-version: 22, cache: npm }
- run: npm ci
- run: npx biome ci .
- run: npm test
- run: npm run build
Q (mid): How do you manage dev/staging/prod environments?

Say this: Use the same code and different config (env vars), with separate databases and secrets per environment. Staging should look like prod. Promote the same build artifact through environments instead of rebuilding. Wrangler has [env.staging] / [env.production] sections. Use preview deployments for each PR. Run DB migrations as part of the deploy pipeline.

Q (mid): Deployment strategies: rolling, blue-green, canary?

Say this: Rolling: replace instances gradually. Blue-green: run the new version alongside the old one, then switch traffic all at once, with instant rollback. Canary: send a small percentage of traffic to the new version, watch the metrics, then increase. Feature flags let you separate deploying code from releasing features.

Q (mid): Merge vs rebase?

Say this (30 sec): Both bring changes from one branch into another. Merge creates a merge commit and keeps the real history. It’s non-destructive. Rebase replays your commits on top of the target branch, which creates new commit hashes and a straight, linear history. Golden rule: don’t rebase commits other people have already pulled. Common workflow: rebase your local feature branch onto main to update it, then merge or squash-merge the PR.

Example:

Terminal window
git switch feature
git fetch origin
git rebase origin/main # fix conflicts, then: git add . && git rebase --continue
git push --force-with-lease

Follow-ups they ask: “Why --force-with-lease instead of --force?” It refuses to push if the remote has commits you haven’t seen, so you don’t overwrite a teammate’s work.

Q (mid): git reset (soft/mixed/hard) vs git revert?

Say this (30 sec):

  • git reset --soft HEAD~1: undo the commit, keep the changes staged.
  • git reset --mixed HEAD~1 (default): undo the commit, keep the changes unstaged.
  • git reset --hard HEAD~1: undo the commit and throw away the changes. Dangerous.
  • git revert <hash>: creates a new commit that undoes that commit. History is kept, so it’s safe for shared branches.

Rule: reset for local, unpushed work. revert for anything already pushed.

Follow-ups they ask: “I hard-reset by mistake, can I recover?” Usually yes, for committed work: git reflog shows where HEAD used to be, then git reset --hard <hash>. Uncommitted changes lost by --hard are generally gone.

Q (basic): What do cherry-pick and stash do?

Say this: git cherry-pick <hash> applies one specific commit from another branch onto the current branch, for example to move a hotfix to a release branch. git stash saves uncommitted changes and cleans the working tree so you can switch branches. git stash pop reapplies them and removes the stash. git stash list shows saved stashes. git stash -u also includes untracked files.

Q (basic): How do you resolve a merge conflict?

Say this: Git marks the conflicting areas with <<<<<<<, =======, and >>>>>>>. Open each file, decide what the final code should be (yours, theirs, or a mix), remove the markers, run the tests, then git add the files and git commit (or git rebase --continue). git merge --abort cancels. Talk to the other author if the intent isn’t clear.

Q (basic): git fetch vs git pull?

Say this: fetch downloads remote commits into the remote-tracking branches (origin/main) without changing your working branch. pull = fetch + merge, or fetch + rebase with --rebase or pull.rebase=true.

Q (mid): What branching strategy do you use?

Say this: GitHub Flow / trunk-based: main is always deployable. Create short-lived feature branches, open a PR with CI and review, squash-merge, and deploy. Git Flow (develop, release, hotfix branches) is heavier and suits versioned releases. Use clear commit messages, e.g. Conventional Commits (feat:, fix:, chore:).

Q (basic): Other common Git commands?

Say this: git log --oneline --graph, git diff (--staged for staged changes), git blame file, git bisect (binary search for the commit that introduced a bug), git commit --amend (fix the last commit, only if not pushed), git restore file (discard changes), git switch -c branch, and git tag v1.0.0.

Q (basic): Commonly asked Linux commands?

Say this:

  • Files: ls -la, cd, pwd, cp -r, mv, rm -rf, mkdir -p, touch, cat, less, head/tail -f (follow logs)
  • Search: grep -rn "text" ., find . -name "*.js"
  • Permissions: chmod 755 file / chmod +x script.sh, chown user:group file
  • Processes: ps aux, top/htop, kill <pid> (SIGTERM), kill -9 <pid> (SIGKILL, can’t be caught)
  • Network: curl, ss -tulpn / lsof -i :3000 (what’s using a port), ping
  • Disk: df -h (free disk space), du -sh * (folder sizes), free -h (memory)
  • Pipes: cat app.log | grep ERROR | wc -l
Q (mid): What does chmod 755 mean?

Say this: There are three digits for owner, group, and others. Each digit is a sum of read (4), write (2), and execute (1). So 7 = rwx and 5 = r-x. 755 means the owner can read, write, and execute, and everyone else can read and execute. 644 is typical for files: owner read/write, everyone else read-only.

Q (basic): What is WSL?

Say this: Windows Subsystem for Linux. WSL2 runs a real Linux kernel in a lightweight VM, so I can use Linux tools, bash, and Docker on Windows. Tip: keep projects inside the Linux filesystem (~/), not /mnt/c, because file I/O across the boundary is much slower.

Q (basic): Biome vs ESLint + Prettier?

Say this (30 sec): Biome is a single tool that does formatting and linting, written in Rust. It’s much faster than ESLint plus Prettier (often 10x or more) and has one config file (biome.json) with no plugin chains. Its formatter is largely Prettier-compatible. biome check --write formats, lints, and sorts imports, and biome ci is for pipelines. The tradeoff: ESLint has a much larger plugin ecosystem (framework-specific and custom rules). Biome covers most common rules and is catching up.

Q (basic): How do you use Postman?

Say this: For manual API testing and documentation. I organize requests in collections, use environments with variables like {{baseUrl}} and {{token}} to switch between local and prod, write pre-request scripts (e.g. to get an auth token), and add tests (pm.test(...) to check status and body). Collections can run in CI with Newman or the Postman CLI.

Q (mid): Monitoring vs logging vs tracing?

Say this (30 sec): These are the three pillars of observability:

  • Logs: discrete events with context (structured JSON, with request IDs).
  • Metrics: numbers over time, like request rate, error rate, latency p95, CPU, and memory (Prometheus and Grafana).
  • Traces: follow one request across services, with time spent in each span (OpenTelemetry, Jaeger).

Add alerts on symptoms (error rate, latency), error tracking (Sentry), uptime checks, and health check endpoints (/health). On Workers: wrangler tail, Workers Logs, and Analytics.