Preparing Docker Volumes

A Docker volume (commonly referred to as data volume) is a specially-designated directory within one or more containers that bypasses the Union File System. Docker volumes provide several useful features for persistent and shared data. Docker volumes can be shared and reused among containers.

Docker volumes persist even if the container itself is deleted. You can create a Docker volume container from an existing image. The volume container has the mapping of the host's directory to the container. For more information, see the Docker documentation on volume.

Before you start running the Docker containers, you are required to have the following directories on the host machine:

 

  • A logs directory that you must create.

Procedure

  • Create a logs directory where logs from all the containers are available on your host machine. For example, $OPE_HOME/logs.

 

Note:

Since the Docker container reads and writes in the directory mentioned, it is mandatory to give read and write privileges to others on the host machine on the directories where you are creating volumes. Since Docker is writing to the existing files in the volume, each file in the volume must have read and write privileges. For example:

Copy
$] chmod o+rw -R
$OPE_HOME/logs