Use Docker Volumes with Local Filesystem Path and NFS

In docker containers, volumes could be mounted as a file or a path. Docker volumes could be even shared among containers, and provides same experience upon different backends.

· 1 min read
Use Docker Volumes with Local Filesystem Path and NFS

In docker containers, volumes could be mounted as a file or a path. Docker volumes could be even shared among containers, and provides same experience upon different backends.

Volumes on Local Path

Docker has a bind mounts feature that allows local path mounted in a container. It could be simply set by docker run -v, but it also could be set with volume name. In docker-compose.yml it would be like:

....
volumes:
    dbdata:
        driver: local
        driver_opts:
            type: 'none'
            o: 'bind'
            device: '/srv/db-data'
....

Volumes on NFS

Docker could also create volume on NFS. In docker-compose.yml

volumes:
    vol:
        drive: local
        driver_opts:
            type: 'nfs'
            o: 'addr=192.168.1.1,rw'
            device: '/path/to/dir'

will mount the /path/to/dir in rw mode from 192.168.1.1 to volume vol.

Related Articles

Rancher Server on RKE Deployment
· 4 min read
Using Linux Containers (LXC) on Fedora
· 3 min read

Notes on Redis Operation

Some common problems and solution to containerized Redis deployment.

· 1 min read

Update (Renew) Certificates in OpenShift (OKD) 3

Server certificates are used to provide encrypted traffic (HTTPS) in OpenShift. When a certificate is near expiration, renewal and replacement

· 1 min read

Helm 2 on OpenShift (OKD) 3

Install the popular Kubernetes package manager and enable cluster-wide install ability. Helm 3? No Way!OpenShift 4 has built-in integration

· 1 min read