Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
84775e414b | ||
|
|
d913ca869c | ||
|
|
3732f968d0 |
No files matched your search
@@ -1,3 +1,11 @@
|
|||||||
|
## Release 1.0.1
|
||||||
|
|
||||||
|
This is a bug fix release, addressing the following issue:
|
||||||
|
|
||||||
|
- executing `docker run` from a Docker 1.7 client against the weave
|
||||||
|
proxy would report a `no such image` error when the requested image
|
||||||
|
wasn't present on the Docker host, instead of downloading it.
|
||||||
|
|
||||||
## Release 1.0.0
|
## Release 1.0.0
|
||||||
|
|
||||||
**Highlights**:
|
**Highlights**:
|
||||||
|
|||||||
@@ -21,6 +21,17 @@ type createContainerRequestBody struct {
|
|||||||
MacAddress string `json:"MacAddress,omitempty" yaml:"MacAddress,omitempty"`
|
MacAddress string `json:"MacAddress,omitempty" yaml:"MacAddress,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Replacement for docker.NoSuchImage, which does not contain the
|
||||||
|
// image name, which in turn breaks docker clients post 1.7.0 since
|
||||||
|
// they expect the image name to be present in errors.
|
||||||
|
type ErrNoSuchImage struct {
|
||||||
|
Name string
|
||||||
|
}
|
||||||
|
|
||||||
|
func (err *ErrNoSuchImage) Error() string {
|
||||||
|
return "No such image: " + err.Name
|
||||||
|
}
|
||||||
|
|
||||||
func (i *createContainerInterceptor) InterceptRequest(r *http.Request) error {
|
func (i *createContainerInterceptor) InterceptRequest(r *http.Request) error {
|
||||||
body, err := ioutil.ReadAll(r.Body)
|
body, err := ioutil.ReadAll(r.Body)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -63,7 +74,9 @@ func (i *createContainerInterceptor) InterceptRequest(r *http.Request) error {
|
|||||||
func (i *createContainerInterceptor) setWeaveWaitEntrypoint(container *docker.Config) error {
|
func (i *createContainerInterceptor) setWeaveWaitEntrypoint(container *docker.Config) error {
|
||||||
if len(container.Entrypoint) == 0 {
|
if len(container.Entrypoint) == 0 {
|
||||||
image, err := i.proxy.client.InspectImage(container.Image)
|
image, err := i.proxy.client.InspectImage(container.Image)
|
||||||
if err != nil {
|
if err == docker.ErrNoSuchImage {
|
||||||
|
return &ErrNoSuchImage{container.Image}
|
||||||
|
} else if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -16,11 +16,10 @@ import (
|
|||||||
|
|
||||||
func (proxy *Proxy) Intercept(i interceptor, w http.ResponseWriter, r *http.Request) {
|
func (proxy *Proxy) Intercept(i interceptor, w http.ResponseWriter, r *http.Request) {
|
||||||
if err := i.InterceptRequest(r); err != nil {
|
if err := i.InterceptRequest(r); err != nil {
|
||||||
_, isNoSuchContainer := err.(*docker.NoSuchContainer)
|
switch err.(type) {
|
||||||
switch {
|
case *docker.NoSuchContainer:
|
||||||
case isNoSuchContainer:
|
|
||||||
http.Error(w, err.Error(), http.StatusNotFound)
|
http.Error(w, err.Error(), http.StatusNotFound)
|
||||||
case err == docker.ErrNoSuchImage:
|
case *ErrNoSuchImage:
|
||||||
http.Error(w, err.Error(), http.StatusNotFound)
|
http.Error(w, err.Error(), http.StatusNotFound)
|
||||||
default:
|
default:
|
||||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||||
|
|||||||
Reference in new issue
Block a user