Skip to content

Commit

Permalink
Merge pull request #2033 from hashicorp/b-docker-container-exists
Browse files Browse the repository at this point in the history
Make container exist errors non-retriable
  • Loading branch information
dadgar committed Nov 28, 2016
2 parents 8983918 + 49ee34c commit 23cdb37
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 2 deletions.
4 changes: 2 additions & 2 deletions client/driver/docker.go
Original file line number Diff line number Diff line change
Expand Up @@ -949,8 +949,7 @@ func (d *DockerDriver) createContainer(config docker.CreateContainerOptions) (*d
recoverable := func(err error) *structs.RecoverableError {
r := false
if strings.Contains(err.Error(), "Client.Timeout exceeded while awaiting headers") ||
strings.Contains(err.Error(), "EOF") ||
strings.Contains(err.Error(), "container already exists") {
strings.Contains(err.Error(), "EOF") {
r = true
}
return structs.NewRecoverableError(err, r)
Expand Down Expand Up @@ -997,6 +996,7 @@ CREATE:

if attempted < 5 {
attempted++
time.Sleep(1 * time.Second)
goto CREATE
}
}
Expand Down
6 changes: 6 additions & 0 deletions demo/vagrant/client1.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,9 @@ client {
ports {
http = 5656
}

advertise {
http = "localhost"
rpc = "localhost"
serf = "localhost"
}
6 changes: 6 additions & 0 deletions demo/vagrant/client2.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,9 @@ client {
ports {
http = 5657
}

advertise {
http = "localhost"
rpc = "localhost"
serf = "localhost"
}
6 changes: 6 additions & 0 deletions demo/vagrant/server.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,9 @@ server {
# Self-elect, should be 3 or 5 for production
bootstrap_expect = 1
}

advertise {
http = "localhost"
rpc = "localhost"
serf = "localhost"
}

0 comments on commit 23cdb37

Please sign in to comment.