Skip to content

Instantly share code, notes, and snippets.

@runcom
Last active November 15, 2016 21:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save runcom/296684bcfca2e1b532e498a861e92460 to your computer and use it in GitHub Desktop.
Save runcom/296684bcfca2e1b532e498a861e92460 to your computer and use it in GitHub Desktop.
test out layer federation with docker
version: 0.1
log:
fields:
service: registry
storage:
cache:
blobdescriptor: inmemory
filesystem:
rootdirectory: ./reg_store
http:
addr: :5000
host: myregistrydomain.com:5000
headers:
X-Content-Type-Options: [nosniff]
health:
storagedriver:
enabled: true
interval: 10s
threshold: 3
#validation:
#enabled: true
#manifests:
#urls:
#allow:
#- ^https?://([^/]+\.)*runcom\.red/
#deny:
#- ^https?://www\.runcomtypo\.red/
cd $GOPATH/src/github.com/projectatomic/skopeo
git remote add runcom https://github.com/runcom/skopeo
git fetch runcom -a
git checkout --track runcom/layerfed
make binary-local
cd $GOPATH/src/github.com/docker/distribution
git pull
make binaries
./bin/registry serve config.yml # config.yml is provided above
cd $GOPATH/src/github.com/projectatomic/skopeo
mkdir ./test
./skopeo copy docker://runcom/layerfed0 dir:test
# now edit ./test/manifest.json and use either "manifest_missing_layer" or "manifest_with_federated_layer"
# the difference is just that 1 layer is present on runcom.red, the other is not (to test what happens if the layer
# is missing)
# manifest_missing_layer
./skopeo --tls-verify=false --debug copy dir:test docker://myregistrydomain.com:5000/layerfedmissing
# re-edit the manifest again with manifest_with_federated_layer
./skopeo --tls-verify=false --debug copy dir:test docker://myregistrydomain.com:5000/layerfed
sudo rm -rf /var/lib/docker
# starting fresh...
# compile and install docker from https://github.com/docker/docker/pull/27961
docker pull myregistrydomain.com:5000/layerfed # you'll successfully fetch the layer from runcom.red/layer.tar
docker pull myregistrydomain.com:5000/layerfedmissing # you'll eventually get a timeout here
# for the sake of curiosity you can inspect the registry to see that the federated layer isn't present locally in the
# registry store
cd $GOPATH/src/github.com/docker/distribution
# now go into ./reg_store if you used the config.yml above
cd ./reg_store
find . | grep 56be
# nothing shows up, that 56be is the layer which is on runcom.red
{
"schemaVersion": 2,
"mediaType": "application/vnd.docker.distribution.manifest.v2+json",
"config": {
"mediaType": "application/vnd.docker.container.image.v1+json",
"size": 1784,
"digest": "sha256:baf06652cc36be49f25c2e18163f8fa0a29f359ceddb08a753aebaa5d277fba4"
},
"layers": [
{
"mediaType": "application/vnd.docker.image.rootfs.diff.tar.gzip",
"size": 668151,
"digest": "sha256:56bec22e355981d8ba0878c6c2f23b21f422f30ab0aba188b54f1ffeff59c190",
"urls": [
"https://runcom.red/layer_not_exists.tar"
]
},
{
"mediaType": "application/vnd.docker.image.rootfs.diff.tar.gzip",
"size": 110,
"digest": "sha256:e55b504c4cb5ebda821866e5658f23fbd1184c4c75e60e7ba4d86807e0cab77a"
}
]
}
{
"schemaVersion": 2,
"mediaType": "application/vnd.docker.distribution.manifest.v2+json",
"config": {
"mediaType": "application/vnd.docker.container.image.v1+json",
"size": 1784,
"digest": "sha256:baf06652cc36be49f25c2e18163f8fa0a29f359ceddb08a753aebaa5d277fba4"
},
"layers": [
{
"mediaType": "application/vnd.docker.image.rootfs.diff.tar.gzip",
"size": 668151,
"digest": "sha256:56bec22e355981d8ba0878c6c2f23b21f422f30ab0aba188b54f1ffeff59c190",
"urls": [
"https://runcom.red/layer.tar"
]
},
{
"mediaType": "application/vnd.docker.image.rootfs.diff.tar.gzip",
"size": 110,
"digest": "sha256:e55b504c4cb5ebda821866e5658f23fbd1184c4c75e60e7ba4d86807e0cab77a"
}
]
}
@aweiteka
Copy link

git checkout --track runcom/layerfed

@runcom I don't see anybranches but master. What am I missing?

@aweiteka
Copy link

@aweiteka
Copy link

RHEL requirements:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment