惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

博客园_首页
GbyAI
GbyAI
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Apple Machine Learning Research
Apple Machine Learning Research
大猫的无限游戏
大猫的无限游戏
阮一峰的网络日志
阮一峰的网络日志
Last Week in AI
Last Week in AI
V
Visual Studio Blog
酷 壳 – CoolShell
酷 壳 – CoolShell
The Cloudflare Blog
博客园 - 【当耐特】
博客园 - 叶小钗
量子位
博客园 - 聂微东
S
SegmentFault 最新的问题
美团技术团队
Hugging Face - Blog
Hugging Face - Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
月光博客
月光博客
宝玉的分享
宝玉的分享
小众软件
小众软件
罗磊的独立博客
有赞技术团队
有赞技术团队
Stack Overflow Blog
Stack Overflow Blog

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant
Docker 101: How I Mastered Docker Build Processes In One ...
Misha · 2026-04-28 · via DEV Community
Cover image for Docker 101: How I Mastered Docker Build Processes In One Night

Misha

Docker Competencies: Part 1/3 (BASIC)

From "I've heard of it" to "I can ship it"

Task 1: Create a Multi-Stage Build

  • Write a Dockerfile for an app that uses a heavy build image (like node:latest) to install dependencies, but then copies only the necessary production files into a slim runtime image (like node:alpine).
  • The Goal: Compare the final image sizes.
  • Resource: More ways to reduce image size

Img

Task 2: The "Bridge Network" Handshake

  • Deploy two containers: an API container (e.g., Flask/Express) and a UI container (Nginx-based).
  • The Goal: Create a custom Docker network and ensure the containers can communicate using the container name as the hostname, rather than a hardcoded IP.
  • Key Concept: Containers should talk via names, not unstable IP addresses.
  • Resource: Docker Bridge Network

Img

Task 3: "Legacy to Linux" Migration

  • Take a basic HTML/JS frontend that runs locally and containerize it using Nginx.
  • The Goal: Inject an environment variable into the container to change the background color of the UI.
  • Optimization: Use a .dockerignore file to ensure node_modules or local logs aren't accidentally copied into the image.
  • Resource: Migrate Legacy Apps to Docker

Img

Task 4: Master Container Lifecycle Commands

Execute the following sequence to master the CLI:

  • Detached Mode: Run a Redis container in the background: docker run --name my-cache -d redis.
  • Port Mapping: Map port 6379 of the container to 7000 on your host.
  • Restart Policy: Run a container with --restart unless-stopped and manually restart your Docker Desktop/Daemon to see if it recovers.
  • Auto-Cleanup: Run a temporary "Hello World" container with the --rm flag to ensure it deletes itself after execution.

Img

Task 5: Deploy to a Docker Registry

  1. Create a repository on Docker Hub or GitHub Packages.
  2. Tag your local image: docker tag /:v1.0.
  3. Authenticate via CLI (docker login) and push the image.
  4. Delete the local image and pull it back down to prove it’s stored in the cloud.

Img

Task 6: Cross-Platform .NET Deployment

  1. Create a standard .NET 8 (or 6/7) Web API.
  2. Build it using a Linux-based SDK image.
  3. Switch Docker Desktop to "Windows Container" mode and build using Windows Server Core or Nano Server.

The Goal: Observe the difference in startup time and image size between native Windows and Linux-based containers.

Img


🛠️ Pro-Tips: Working in Neovim
If you live in the terminal, you can manage Docker without leaving your editor.

Plugin Support:

nvim-docker: Provides a UI to list, start, stop, and delete containers (use r for restart, t for logs).

denops-docker.vim: Manage images/containers and search Docker Hub directly from Neovim.

devops-tools.nvim: Adds handy commands like :DockerPs and :DockerImages.

LSP & Syntax:

Install the *Docker Language Server *(via Mason) for autocompletion, linting, and hover documentation.

Terminal Integration: Open a terminal inside a split (:term) to run Docker commands while editing your Dockerfile.

Lazy Management: Use lazydocker (a TUI for Docker) and toggle it inside Neovim using toggleterm.nvim.

Advanced Note: For Task 6, you can even install Neovim inside your dev container. Tools like** DevPod or nvim-remote-containers **allow you to edit files directly inside a running Docker environment.