-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding new example: Docker Registry #53
base: master
Are you sure you want to change the base?
Changes from all commits
d5f57b5
a92ef58
80bc4a1
75223a9
b7bc9ab
f7df968
bb9a22b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
version: '2' | ||
|
||
services: | ||
registry: | ||
image: registry | ||
ports: | ||
- 5000 | ||
volumes: | ||
- /denverimaging/e3ebf132-c720-4d33-afe0-7b858eb88cdd/3dc9dd9a-802f-4dee-83dc-955f32165f08:/var/lib/registry | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
docker_app: docker-compose.yml | ||
|
||
flocker_hub: | ||
endpoint: https://data.flockerhub.clusterhq.com | ||
tokenfile: /root/vhut.txt | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
||
volumes: | ||
- name: registry-mount | ||
snapshot: docker-images | ||
volumeset: flidocker-example-registry-6 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
function fli () { | ||
local zpool_name='denverimaging' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should probably be configurable, as they may not want or have this as a zpool name |
||
docker run --rm -it --privileged -v /etc/hosts:/etc/hosts -v /root:/root -v /${zpool_name}:/${zpool_name}:shared -v /var/log/fli:/var/log/fli -v /lib/modules:/lib/modules quay.io/clusterhq_prod/fli:c6a5deac3bb68b93341c8accfdde66fd7d13fc1f "$@" | ||
} | ||
|
||
### Set a unique VOlumeSet and Volume name | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. where are these used. Not seeing where volumeset_name, volume_name or snapshot_name is used? |
||
volumeset_name='flidocker-example-registry-6' | ||
volume_name='dockerregistry' | ||
snapshot_name='docker-images' | ||
flidocker_path='/tmp/fli-docker' | ||
flockerhub_token_path='/root/vhut.txt' | ||
|
||
if test ! -e $flockerhub_token_path | ||
then | ||
echo "FlockerHub token file does not exist: ${flockerhub_token_path}" | ||
exit 10 | ||
fi | ||
|
||
### Invoke Fli-Docker | ||
echo "$(tput setaf 6)Invoking Fli-Docker ..." | ||
${flidocker_path} run -verbose -f fli-manifest.yml -c |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
#!/bin/bash | ||
|
||
function PrepSnapshot () { | ||
### Create a VolumeSet and Volume | ||
volumeset_id=`fli init ${volumeset_name} | tr -d '\r'` | ||
volume_dir=`fli create ${volumeset_id} ${volume_name} | tr -d '\r'` | ||
echo "$(tput setaf 6)Created VolumeSet ${volumeset_id} and Volume ${volume_dir}$(tput setaf 7)" | ||
|
||
### Start a private, temporary registry instance | ||
### This will simply be used to stage some data onto a Fli Volume, so we can snapshot it | ||
docker run --detach -v ${volume_dir}:/var/lib/registry -p 5000:5000 --name registry-temp registry | ||
|
||
### Download Docker images locally | ||
docker pull microsoft/powershell:centos7 | ||
docker pull microsoft/powershell:ubuntu14.04 | ||
docker pull microsoft/powershell:ubuntu16.04 | ||
docker pull microsoft/powershell:latest | ||
|
||
docker tag microsoft/powershell:centos7 localhost:5000/microsoft/powershell:centos7 | ||
docker tag microsoft/powershell:ubuntu14.04 localhost:5000/microsoft/powershell:ubuntu14.04 | ||
docker tag microsoft/powershell:ubuntu16.04 localhost:5000/microsoft/powershell:ubuntu16.04 | ||
docker tag microsoft/powershell:latest localhost:5000/microsoft/powershell:latest | ||
|
||
### Push images up to the private registry instance | ||
docker push localhost:5000/microsoft/powershell:centos7 | ||
#docker push localhost:5000/microsoft/powershell:ubuntu14.04 | ||
#docker push localhost:5000/microsoft/powershell:ubuntu16.04 | ||
#docker push localhost:5000/microsoft/powershell:latest | ||
|
||
### Take a snapshot of the Fli Volume | ||
snapshot_id=`fli snapshot ${volumeset_id}:${volume_name} ${snapshot_name} | tr -d '\r'` | ||
echo "$(tput setaf 6)Finished snapshotting the data volume ${volume_dir}. Snapshot ID is: ${snapshot_id}" | ||
|
||
### Sync the VolumeSet with FlockerHub | ||
fli sync ${volumeset_id} | ||
echo "$(tput setaf 6)Synchronized VolumeSet (${volumeset_id}) with FlockerHub" | ||
|
||
### Push the snapshot up to FlockerHub | ||
fli push ${volumeset_id}:${snapshot_id} | ||
echo "$(tput setaf 6)Finished pushing snapshot (${snapshot_id}), in VolumeSet (${volumeset_id}) to FlockerHub$(tput setaf 7)" | ||
} | ||
|
||
PrepSnapshot |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this path be in here? Think this should be
registry-mount