mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Remove https prefix from registry
This commit is contained in:
parent
50075106b6
commit
57d751c377
2 changed files with 6 additions and 5 deletions
|
@ -154,7 +154,7 @@ func (r *Registry) GetRemoteTags(registries []string, repository string, token [
|
||||||
repository = "library/" + repository
|
repository = "library/" + repository
|
||||||
}
|
}
|
||||||
for _, host := range registries {
|
for _, host := range registries {
|
||||||
endpoint := fmt.Sprintf("https://%s/v1/repositories/%s/tags", host, repository)
|
endpoint := fmt.Sprintf("%s/v1/repositories/%s/tags", host, repository)
|
||||||
req, err := r.opaqueRequest("GET", endpoint, nil)
|
req, err := r.opaqueRequest("GET", endpoint, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
@ -249,7 +249,7 @@ func (r *Registry) GetRepositoryData(remote string) (*RepositoryData, error) {
|
||||||
|
|
||||||
// Push a local image to the registry
|
// Push a local image to the registry
|
||||||
func (r *Registry) PushImageJSONRegistry(imgData *ImgData, jsonRaw []byte, registry string, token []string) error {
|
func (r *Registry) PushImageJSONRegistry(imgData *ImgData, jsonRaw []byte, registry string, token []string) error {
|
||||||
registry = "https://" + registry + "/v1"
|
registry = registry + "/v1"
|
||||||
// FIXME: try json with UTF8
|
// FIXME: try json with UTF8
|
||||||
req, err := http.NewRequest("PUT", registry+"/images/"+imgData.ID+"/json", strings.NewReader(string(jsonRaw)))
|
req, err := http.NewRequest("PUT", registry+"/images/"+imgData.ID+"/json", strings.NewReader(string(jsonRaw)))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -285,7 +285,7 @@ func (r *Registry) PushImageJSONRegistry(imgData *ImgData, jsonRaw []byte, regis
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *Registry) PushImageLayerRegistry(imgId string, layer io.Reader, registry string, token []string) error {
|
func (r *Registry) PushImageLayerRegistry(imgId string, layer io.Reader, registry string, token []string) error {
|
||||||
registry = "https://" + registry + "/v1"
|
registry = registry + "/v1"
|
||||||
req, err := http.NewRequest("PUT", registry+"/images/"+imgId+"/layer", layer)
|
req, err := http.NewRequest("PUT", registry+"/images/"+imgId+"/layer", layer)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
@ -323,7 +323,7 @@ func (r *Registry) opaqueRequest(method, urlStr string, body io.Reader) (*http.R
|
||||||
func (r *Registry) PushRegistryTag(remote, revision, tag, registry string, token []string) error {
|
func (r *Registry) PushRegistryTag(remote, revision, tag, registry string, token []string) error {
|
||||||
// "jsonify" the string
|
// "jsonify" the string
|
||||||
revision = "\"" + revision + "\""
|
revision = "\"" + revision + "\""
|
||||||
registry = "https://" + registry + "/v1"
|
registry = registry + "/v1"
|
||||||
|
|
||||||
req, err := r.opaqueRequest("PUT", registry+"/repositories/"+remote+"/tags/"+tag, strings.NewReader(revision))
|
req, err := r.opaqueRequest("PUT", registry+"/repositories/"+remote+"/tags/"+tag, strings.NewReader(revision))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -418,7 +418,7 @@ func (srv *Server) pullRepository(r *registry.Registry, out io.Writer, local, re
|
||||||
out.Write(sf.FormatStatus("Pulling image %s (%s) from %s", img.ID, img.Tag, remote))
|
out.Write(sf.FormatStatus("Pulling image %s (%s) from %s", img.ID, img.Tag, remote))
|
||||||
success := false
|
success := false
|
||||||
for _, ep := range repoData.Endpoints {
|
for _, ep := range repoData.Endpoints {
|
||||||
if err := srv.pullImage(r, out, img.ID, "https://"+ep+"/v1", repoData.Tokens, sf); err != nil {
|
if err := srv.pullImage(r, out, img.ID, ep+"/v1", repoData.Tokens, sf); err != nil {
|
||||||
out.Write(sf.FormatStatus("Error while retrieving image for tag: %s (%s); checking next endpoint", askedTag, err))
|
out.Write(sf.FormatStatus("Error while retrieving image for tag: %s (%s); checking next endpoint", askedTag, err))
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
@ -717,6 +717,7 @@ func (srv *Server) ImagePush(name, endpoint string, out io.Writer, sf *utils.Str
|
||||||
if err2 != nil {
|
if err2 != nil {
|
||||||
return err2
|
return err2
|
||||||
}
|
}
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
out.Write(sf.FormatStatus("The push refers to a repository [%s] (len: %d)", name, len(srv.runtime.repositories.Repositories[name])))
|
out.Write(sf.FormatStatus("The push refers to a repository [%s] (len: %d)", name, len(srv.runtime.repositories.Repositories[name])))
|
||||||
// If it fails, try to get the repository
|
// If it fails, try to get the repository
|
||||||
|
|
Loading…
Add table
Reference in a new issue