xiaohongshu
xiaohongshu
docker-volumes
Implement persistent storage with Docker volumes, bind mounts, and backup strategies
Full skill instructions
Master Docker persistent storage including named volumes, bind mounts, tmpfs, and data backup/restore procedures.
Implement reliable data persistence for containers with proper volume management, backup strategies, and permission handling.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| volume_name | string | No | - | Name for the volume |
| mount_type | enum | No | volume | volume/bind/tmpfs |
| backup | boolean | No | false | Include backup commands |
| Type | Persistence | Use Case | Managed By |
|---|---|---|---|
| Named Volume | Yes | Production data | Docker |
| Bind Mount | Yes | Development, configs | Host |
| tmpfs | No (memory) | Secrets, temp files | Docker |
| Anonymous | Container lifetime | Scratch space | Docker |
# Create volume
docker volume create app_data
# Use in container
docker run -d \
-v app_data:/var/lib/postgresql/data \
postgres:16-alpine
# Inspect volume
docker volume inspect app_data
# List volumes
docker volume ls
# Remove unused volumes
docker volume prune
# Development - mount source code
docker run -d \
-v $(pwd)/src:/app/src \
node:20-alpine
# Read-only config
docker run -d \
-v /etc/app/config.yaml:/app/config.yaml:ro \
myapp
# Sensitive data in memory
docker run -d \
--tmpfs /app/secrets:rw,noexec,nosuid,size=64m \
myapp
# Compose syntax
services:
app:
volumes:
- type: tmpfs
target: /app/tmp
tmpfs:
size: 100m
services:
database:
image: postgres:16-alpine
volumes:
- db_data:/var/lib/postgresql/data
- ./init.sql:/docker-entrypoint-initdb.d/init.sql:ro
environment:
POSTGRES_PASSWORD: ${DB_PASSWORD}
app:
image: myapp
volumes:
- uploads:/app/uploads
- ./config:/app/config:ro
volumes:
db_data:
driver: local
uploads:
external: true # Pre-created
# Backup to tar file
docker run --rm \
-v app_data:/source:ro \
-v $(pwd)/backups:/backup \
alpine tar cvf /backup/app_data_$(date +%Y%m%d).tar -C /source .
# Compressed backup
docker run --rm \
-v app_data:/source:ro \
-v $(pwd)/backups:/backup \
alpine tar czvf /backup/app_data_$(date +%Y%m%d).tar.gz -C /source .
# Restore from tar
docker run --rm \
-v app_data:/dest \
-v $(pwd)/backups:/backup:ro \
alpine tar xvf /backup/app_data_20240101.tar -C /dest
docker run --rm \
-v source_volume:/from:ro \
-v target_volume:/to \
alpine cp -av /from/. /to/
| Error | Cause | Solution |
|---|---|---|
volume in use | Container running | Stop container first |
permission denied | UID mismatch | Fix ownership |
no space left | Disk full | Clean up or expand |
path not found | Bind mount missing | Create directory |
# Check ownership
docker run --rm -v app_data:/data alpine ls -la /data
# Fix ownership (match container user)
docker run --rm -v app_data:/data alpine chown -R 1000:1000 /data
# SELinux (RHEL/CentOS)
docker run -v /host/path:/container/path:Z myimage
docker volume lsdocker exec <c> df -hls -la in container# Check volume location
docker volume inspect app_data --format '{{.Mountpoint}}'
# Check container mounts
docker inspect <container> --format '{{json .Mounts}}'
# Check disk usage
docker system df -v
Skill("docker-volumes")
xiaohongshu
technical spec
product ux expert
database patterns
Conduct multi-agent task orchestration and workflow coordination.
Initialize project with Conductor artifacts (product definition,
Expert in web animations, transitions, and motion design using Framer Motion and CSS
Creates Mermaid and ASCII diagrams for flowcharts, architecture, ERDs, state machines, mindmaps, and more. Use when user mentions diagram, flowchart, mermaid, ASCII diagram, text diagram, terminal diagram, visualize, C4, mindmap, architecture diagram, sequence diagram, ERD, or needs visual docume...
PostgreSQL bindings for H3 hexagonal grid system. Use when working with H3 cells in Postgres, including spatial indexing, geometry/geography integration, and raster analysis.
Context-Driven Development skill for projects using Conductor. Use this skill when you detect a `conductor/` directory in the project, when working on tasks defined in a `plan.md` file, or when the user asks about tracks, specs, or plans. Automatically applies TDD workflow, tracks task completion...
Display project status, active tracks, and next actions
Official Stakpak application containerization standard operating procedure, a step-by-step guidline to properly dockerize applications. This is a rule book curated by the Stakpak Team.
Generate, edit, and beat-sync AI video with leading models in one workspace.
The world's fastest calendar for remote work
Transform Your Design with AI Designer by ImgCreator.ai
Revolutionizing Video Production with AI-Powered Creativity
Extend an image past the frame and let AI fill the new aspect ratio.
Discover your celebrity doppelgänger with StarByFace!
ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.
Opus.ai: Revolutionize Your Web Experience