Menu

📰
0

Docker for Beginners: From Zero to Running a Full Stack Locally in 10 Minutes

DEV Community: docker·TrackStack·about 1 month ago
#qiPffaGs
#dev#class#code#docker#highlight#article
Reading 0:00
15s threshold

"Install PostgreSQL, then Redis, then Elasticsearch, configure these 12 environment variables, make sure you're on Node 20 not 18, and oh — the tests need Python 3.11." Sound like your onboarding doc? Here's the Docker version: docker compose up . Done. New dev writes code in 15 minutes. The 3 Commands That Cover 80% of Docker You don't need to learn everything. Start here: # Run any service instantly docker run -d -p 8080:80 nginx:latest # Build your own app into an image docker build -t my-app:1.0 . # Start your entire stack (app + db + cache) docker compose up -d Open http://localhost:8080 after the first command — you'll see Nginx running. No install, no config, no conflicts. Your First Dockerfile (Copy This) A Dockerfile is a recipe for turning your code into a container. Here's one for a Node.js app: FROM node:20-alpine WORKDIR /app COPY package*.json ./ RUN npm ci --only = production COPY . . EXPOSE 3000 CMD ["node", "server.js"] The trick: COPY package*.json before COPY . .…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.

Read More