-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support publishing as Docker Engine managed plugin
Signed-off-by: Olli Janatuinen <[email protected]>
- Loading branch information
Showing
6 changed files
with
86 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,3 +8,4 @@ jobs: | |
- checkout | ||
- run: make circleci | ||
- run: sudo make test | ||
- run: make -f plugin/Makefile create |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
* | ||
!/plugin/ | ||
!/docker-lvm-plugin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,7 +9,10 @@ This plugin can be used to create lvm volumes of specified size, which can | |
then be bind mounted into the container using `docker run` command. | ||
|
||
## Setup | ||
### Using Docker | ||
docker plugin install --alias lvm containers/docker-lvm-plugin/docker-lvm-plugin VOLUME_GROUP=vg0 | ||
|
||
### Manual | ||
1) git clone [email protected]:projectatomic/docker-lvm-plugin.git (You can also use HTTPS to clone: git clone https://github.com/projectatomic/docker-lvm-plugin.git) | ||
2) cd docker-lvm-plugin | ||
3) export GO111MODULE=on | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
FROM alpine | ||
RUN apk update && apk add lvm2 xfsprogs cryptsetup thin-provisioning-tools | ||
RUN mkdir -p /var/lib/docker-lvm-plugin | ||
COPY docker-lvm-plugin / |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
name := containers/docker-lvm-plugin | ||
|
||
.PHONY: build | ||
build: docker-lvm-plugin | ||
|
||
docker-lvm-plugin: main.go driver.go utils.go go.mod go.sum | ||
docker run --rm --tmpfs /tmp -v $(shell pwd):/tmp/docker-lvm-plugin -w /tmp/docker-lvm-plugin golang:latest go build | ||
|
||
.PHONY: create | ||
create: plugin/config.json plugin/rootfs | ||
docker plugin rm --force $(name) || true | ||
docker plugin create $(name) plugin | ||
|
||
.PHONY: install | ||
install: create | ||
docker plugin rm --force $(name) || true | ||
docker plugin install $(name) --grant-all-permissions | ||
|
||
.PHONY: push | ||
push: create | ||
docker plugin push $(name) | ||
|
||
.PHONY: enable | ||
enable: create | ||
docker plugin enable $(name) | ||
|
||
.PHONY: clean | ||
clean: | ||
rm -rf plugin | ||
|
||
plugin/rootfs: .dockerignore plugin/Dockerfile docker-lvm-plugin | ||
docker build --tag $(name):rootfs -f plugin/Dockerfile . | ||
docker rm --force --volumes rootfs || true | ||
docker create --name rootfs $(name):rootfs | ||
rm -rf $@ | ||
mkdir -p $@ | ||
docker export rootfs | tar -x -C $@ | ||
docker rm --force --volumes rootfs | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
{ | ||
"Description": "LVM volume plugin for Docker", | ||
"Documentation": "https://docs.docker.com/engine/extend/plugins/", | ||
"Entrypoint": ["/docker-lvm-plugin"], | ||
"Env": [ | ||
{ | ||
"Name": "VOLUME_GROUP", | ||
"Description": "LVM volume group to create volumes in.", | ||
"Settable": ["value"], | ||
"Value": null | ||
} | ||
], | ||
"Interface": { | ||
"Socket": "lvm.sock", | ||
"Types": ["docker.volumedriver/1.0"] | ||
}, | ||
"Linux": { | ||
"Capabilities": ["CAP_SYS_ADMIN"], | ||
"AllowAllDevices": true, | ||
"Devices": null | ||
}, | ||
"Mounts": [ | ||
{ | ||
"description": "Device access for devicemapper (/dev/mapper/*, /dev/*/*)", | ||
"destination": "/dev", | ||
"options": ["rbind"], | ||
"name": "dev", | ||
"source": "/dev", | ||
"type": "bind" | ||
} | ||
], | ||
"Network": { | ||
"Type": "host" | ||
}, | ||
"PropagatedMount": "/var/lib/docker-lvm-plugin" | ||
} |