Keyboard Shortcuts N Next post
P Previous post
S Save / unsave
R Read aloud
T Toggle theme
/ Focus search
Esc Close panels
🔥
Ready to read...
Docker Docker & Containers: From Zero to Production Docker Volumes Module 4 — Volumes and Data

Sharing Data Between Containers — Volumes and --volumes-from

Reviewed & accurate
AI Summary

What You'll Learn

Beginner

  • How to share a volume between multiple containers
  • The --volumes-from flag
  • Common sharing patterns
Terminalbash
# Shared named volume
docker volume create shared-data
docker run -d --name writer -v shared-data:/data alpine sh -c 'echo "hello" > /data/msg.txt && sleep 3600'
docker run --rm -v shared-data:/data alpine cat /data/msg.txt
Mount the same named volume to multiple containers.--volumes-from inherits all volumes from another container.Use :ro for read-only mounts.

Key Takeaways

  • P
  • a
  • t
  • t
  • e
  • r
  • n
  • s
  • :
  • s
  • h
  • a
  • r
  • e
  • d
  • c
  • o
  • n
  • f
  • i
  • g
  • ,
  • l
  • o
  • g
  • a
  • g
  • g
  • r
  • e
  • g
  • a
  • t
  • i
  • o
  • n
  • .
Previously: Lesson 26 covered backups.
Today: You learned: Share data between containers using shared volumes.
Next: Module 4 complete! Module 5 begins with lesson 28.
Test Your Knowledge
How did you find this?

Comments

Join the discussion! Sign in with your Google or Blogger account, or comment as Anonymous - no account needed. For quick questions, also reach me on Telegram @cytestch.

Comments