docker registry v2 install run安装运行

1.第一步:执行命令 mkdir -p /var/lib/registry,创建存储镜像文件的目录

2.第二步:执行go get github.com/docker/distribution/cmd/registry下载并安装distribution


[root@centos-master registry]# go get github.com/docker/distribution/cmd/registry
# github.com/docker/distribution/registry/api/errcode
/root/zq/Source/gowork/src/

# github.com/stevvooe/resumable/sha512
/root/zq/Source/gowork/src/github.com/stevvooe/resumable/sha512/resume.go:56: undefined: crypto.SHA512_224
/root/zq/Source/gowork/src/github.com/stevvooe/resumable/sha512/resume.go:56: undefined: crypto.SHA512_256
/root/zq/Source/gowork/src/github.com/stevvooe/resumable/sha512/sha512.go:17: undefined: crypto.SHA512_224
/root/zq/Source/gowork/src/github.com/stevvooe/resumable/sha512/sha512.go:18: undefined: crypto.SHA512_256
/root/zq/Source/gowork/src/github.com/stevvooe/resumable/sha512/sha512.go:95: undefined: crypto.SHA512_224
/root/zq/Source/gowork/src/github.com/stevvooe/resumable/sha512/sha512.go:104: undefined: crypto.SHA512_256
/root/zq/Source/gowork/src/github.com/stevvooe/resumable/sha512/sha512.go:136: undefined: crypto.SHA512_224
/root/zq/Source/gowork/src/github.com/stevvooe/resumable/sha512/sha512.go:143: undefined: crypto.SHA512_256
/root/zq/Source/gowork/src/github.com/stevvooe/resumable/sha512/sha512.go:157: undefined: crypto.SHA512_224
/root/zq/Source/gowork/src/github.com/stevvooe/resumable/sha512/sha512.go:159: undefined: crypto.SHA512_256
/root/zq/Source/gowork/src/github.com/stevvooe/resumable/sha512/sha512.go:159: too many errors
# rsc.io/letsencrypt
/root/zq/Source/gowork/src/rsc.io/letsencrypt/lets.go:703: undefined: acme.TLSSNI01ChallengeCertDomain
/root/zq/Source/gowork/src/rsc.io/letsencrypt/lets.go:716: undefined: acme.TLSSNI01ChallengeCertDomain
# github.com/docker/distribution/registry/storage/driver/azure
/root/zq/Source/gowork/src/github.com/docker/distribution/registry/storage/driver/azure/azure.go:119: not enough arguments in call to d.client.DeleteBlobIfExists
/root/zq/Source/gowork/src/github.com/docker/distribution/registry/storage/driver/azure/azure.go:154: not enough arguments in call to d.client.GetBlobRange
/root/zq/Source/gowork/src/github.com/docker/distribution/registry/storage/driver/azure/azure.go:177: not enough arguments in call to d.client.DeleteBlob
/root/zq/Source/gowork/src/github.com/docker/distribution/registry/storage/driver/azure/azure.go:275: not enough arguments in call to d.client.DeleteBlob
/root/zq/Source/gowork/src/github.com/docker/distribution/registry/storage/driver/azure/azure.go:280: not enough arguments in call to d.client.DeleteBlobIfExists
/root/zq/Source/gowork/src/github.com/docker/distribution/registry/storage/driver/azure/azure.go:295: not enough arguments in call to d.client.DeleteBlob
/root/zq/Source/gowork/src/github.com/docker/distribution/registry/storage/driver/azure/azure.go:445: not enough arguments in call to w.driver.client.DeleteBlob
/root/zq/Source/gowork/src/github.com/docker/distribution/registry/storage/driver/azure/azure.go:473: not enough arguments in call to bw.client.AppendBlock


[root@centos-master distribution]# go env
GOARCH="amd64"
GOBIN="/root/zq/Source/gowork/bin"
GOCHAR="6"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/root/zq/Source/gowork"
GORACE=""
GOROOT="/root/zq/Source/go"
GOTOOLDIR="/root/zq/Source/go/pkg/tool/linux_amd64"
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0"
CXX="g++"
CGO_ENABLED="1"


[root@centos-master distribution]# go version
go version go1.4.2 linux/amd64

报错,因为golang版本较低,从错误可以看出,出错的地方为golang源码包

要保证golang语言的版本在1.5以上,不然提示一堆错误,比如crypto中的sha512错误


解决办法: 升级golang版本到1.6 (因为1.6是最新版本,故用了1.6,没有特别用意,用1.5也可以)

a. 下载golang1.6安装包,去golang官网->downloads

wget https://storage.googleapis.com/golang/go1.6.2.linux-amd64.tar.gz

tar -zvxf go1.6.2.linux-amd64.tar.gz -C /usr/local/
export GOROOT=/usr/local/go
export PATH=$PATH:$GOROOT/bin

[root@centos-master src]# go version
go version go1.6.2 linux/amd64

golang升级完成.

=============================================================

再次执行安装registry 

[root@centos-master registry]# go get github.com/docker/distribution/cmd/registry 成功.

[root@centos-master Source]# cd /root/zq/Source/gowork/bin
[root@centos-master bin]# ls
cover  godep  registry

至此, registry安装完成.

============================================================

启动registry

cp  /root/zq/Source/gowork/src/github.com/docker/distribution/cmd/registry/config-example.yml  ~

[root@centos-master ~]# registry serve config-example.yml 
WARN[0000] No HTTP secret provided - generated random secret. This may cause problems with uploads if multiple registries are behind a load-balancer. To provide a shared secret, fill in http.secret in the configuration file or set the REGISTRY_HTTP_SECRET environment variable.  go.version=go1.6.2 instance.id=7b0aec2c-436f-4e5f-98a1-09101b83f673 version=v2.4.1+unknown
INFO[0000] redis not configured                          go.version=go1.6.2 instance.id=7b0aec2c-436f-4e5f-98a1-09101b83f673 version=v2.4.1+unknown
INFO[0000] Starting upload purge in 38m0s                go.version=go1.6.2 instance.id=7b0aec2c-436f-4e5f-98a1-09101b83f673 version=v2.4.1+unknown
INFO[0000] using inmemory blob descriptor cache          go.version=go1.6.2 instance.id=7b0aec2c-436f-4e5f-98a1-09101b83f673 version=v2.4.1+unknown
INFO[0000] listening on [::]:5000                        go.version=go1.6.2 instance.id=7b0aec2c-436f-4e5f-98a1-09101b83f673 version=v2.4.1+unknown


============================================================

curl "http://localhost:5000/v2/"

注意 v2后边必须要有/


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值