felipecruz91 / bind-mount-extension

A sample Docker extension to demonstrate how to bind mount a dir to the extension container, and list the content of the bind-mounted file.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

bind-mount-extension

A sample Docker extension to demonstrate how to bind mount a dir to the extension container, and list the content of the bind-mounted file.

Getting started

Edit the docker-compose.yaml file to set the path of the host directory you want to bind-mount to the extension container.

Then, build and install the Docker Extension:

docker build -t felipecruz/bind-mount-extension:latest .
docker extension install felipecruz/bind-mount-extension:latest

Note that Docker Compose can expand the ~ sign (i.e. home), but in the context of extensions a relative path ./ won't work. That is because the path is relative to where the compose command is executed, which in the case of extensions, is at ~/Containers/com.docker.docker/Data/extensions/<your-extension>/vm (in MacOS).

Therefore you can bind-mount a directory using the ~ as follows:

    volumes:
      - ~/src/tmp/bind-mount-extension/data:/tmp

About

A sample Docker extension to demonstrate how to bind mount a dir to the extension container, and list the content of the bind-mounted file.


Languages

Language:TypeScript 32.4%Language:Dockerfile 25.9%Language:Makefile 21.7%Language:Go 14.9%Language:HTML 4.7%Language:Shell 0.4%