Home > Interesting > Using Docker Volumes to Share Data Between Containers and Host Computer

Using Docker Volumes to Share Data Between Containers and Host Computer

Docker volumes are used to persist data from a certain directory or directories of your Docker containers. So your data is not removed when the container stops or is removed.

You can also share a Docker volume to many containers. Let’s talk about a scenario to find out why it’s important.

Let’s say you have a PHP web application. Now you want to test whether it works on PHP version 5.4, 7.0, 7.1, and 7.2. You can create a Docker volume, let’s call it webapp. Then copy the source code files of your PHP web app to the Docker volume webapp. Then you can create containers of different PHP versions and attach the Docker volume webapp to WEBROOT of all these containers. That way, you can easily test how your web app performs on different PHP versions.

In this article, I will show you how to use Docker volumes to share data between containers and the host computer. Let’s get started.

https://linuxhint.com/docker_volume_share_data/

Advertisements
Categories: Interesting Tags:
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: