DEV Community

johanputra
johanputra

Posted on

bind mount and volume

Bind mounts and volumes are both used in Docker to share data between the host machine and the container. However, there are some differences between the two: Bind Mounts:

  • Bind mounts allow you to mount a file or directory on the host machine into a container.
  • Bind mounts can be read-write or read-only.
  • Bind mounts can be used to share data between the host machine and the container.
  • Bind mounts can be used to share data between containers.
  • Bind mounts can be used to access host level resources.

Volumes:

  • Volumes are managed by Docker and are created and managed by Docker commands.
  • Volumes can be used to persist data.
  • Volumes can be shared between containers.
  • Volumes can be backed up and restored.
  • Volumes can be used to improve performance.

In summary, bind mounts are used to share data between the host machine and the container, while volumes are used to persist data and improve performance. Both bind mounts and volumes have their own use cases and can be used together to achieve the desired outcome.

Postmark Image

Speedy emails, satisfied customers

Are delayed transactional emails costing you user satisfaction? Postmark delivers your emails almost instantly, keeping your customers happy and connected.

Sign up

Top comments (0)

Billboard image

Create up to 10 Postgres Databases on Neon's free plan.

If you're starting a new project, Neon has got your databases covered. No credit cards. No trials. No getting in your way.

Try Neon for Free →

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay