A complete reference for Docker containerisation.

Getting Started

# Install Docker
# Check installation
docker --version
 
# Run your first container
docker run hello-world

Basic Commands

# Build an image
docker build -t myapp:1.0 .
 
# Run a container
docker run -d -p 8080:8080 myapp:1.0
 
# View containers
docker ps -a
 
# View images
docker images
 
# Push to registry
docker push myusername/myapp:1.0

Dockerfile Structure

FROM node:18-alpine
WORKDIR /app
COPY package*.json ./
RUN npm install
COPY . .
EXPOSE 3000
CMD ["npm", "start"]

See Also