Skip to content

Latest commit

 

History

History
110 lines (75 loc) · 3.05 KB

README.md

File metadata and controls

110 lines (75 loc) · 3.05 KB

Taylor Swift Volkswagen License

Docker Configuration Volume plugin

ATTENTION

This is a prototype. Do not use in production!

Dependencies

  • go
  • make
  • systemd
  • docker

Install golang dependend packages

make deps

Configuration

Main configuration file /etc/docker/docker-confvol-plugin

Build

Build the whole project make build man or in short make

Installation

sudo -i

make
make install

systemctl daemon-reload
systemctl start docker-confvol-plugin

Use the plugin

You can simply use a direct file mount like this

--mount volume-driver=confvol,target=/etc/nginx/conf.d/site.conf,source=dev/nginx/etc/nginx/conf.d/site.conf

Or the same with a templated configuration

--mount volume-driver=confvol,target=/etc/nginx/conf.d/site.conf,source=dev/nginx/etc/nginx/conf.d/site.conf,volume-opt=gen=1

Or you can mount folders

--mount volume-driver=confvol,target=/var/www/htdocs/,source=dev/nginx/var/www/htdocs/

For the complete example start the vagrant box, the etcd and the etcd browser. Fill the struct from examples/etcd_root to the etcd.

docker run \
    --rm \
    --mount volume-driver=confvol,target=/etc/nginx/conf.d/site.conf,source=dev/example/nginx/conf.d/site.conf \ 
    --mount volume-driver=confvol,target=/var/www/htdocs/,source=dev/example/nginx/htdocs/ \
    -p 8080:8080 \
    -d \
    nginx 

A more complex example with a templated nginx

docker run \
    --rm \
    --mount volume-driver=confvol,target=/etc/nginx/.htpasswd,source=dev/nginx/etc/nginx/.htpasswd,volume-opt=tmpl=1 \    
    --mount volume-driver=confvol,target=/etc/nginx/conf.d/site.conf,source=dev/nginx/etc/nginx/conf.d/site-basicauth.conf \
    --mount volume-driver=confvol,target=/var/www/htdocs/,source=dev/nginx/var/www/htdocs/ \
    -p 8080:8080 \
    -d \
    nginx 

Options

Program arguments

  • --config=<Path> Path to the configuration file

Docker mount arguments

  • volume-driver=confvol specify the driver
  • target=<container-path> mount point within the container
  • source=<conf-path> configuration path
  • volume-opt=tmpl=1 evaluated template file
  • volume-opt=mode=0644 target file mode bits (in octal)
  • readonly readonly mode

Useful ressources

License

Apache-2.0