Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DEVEX-86 Fix Docker blocking on start #2528

Merged
merged 1 commit into from
Feb 2, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 11 additions & 7 deletions config/initializers/docker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@
Docker.url = url
end

Docker.options = { read_timeout: Integer(ENV['DOCKER_READ_TIMEOUT'] || '10'), connect_timeout: 2 }
Docker.options = {
read_timeout: Integer(ENV['DOCKER_READ_TIMEOUT'] || '10'),
connect_timeout: 2,
nonblock: true
}

begin
Docker.validate_version! # Confirm the Docker daemon is a recent enough version
Expand All @@ -21,12 +25,12 @@
# ensure that --cache-from is supported (v13+)
min_version = 13
begin
Timeout.timeout(1) do
local = Integer(`docker -v`[/Docker version (\d+)/, 1])
server = Integer(Docker.version.fetch("Version")[/\d+/, 0])
if local < min_version || server < min_version
raise Docker::Error::VersionError, "Expected docker version to be >= #{min_version}"
end
local = Timeout.timeout(1) do
Integer(`docker -v`[/Docker version (\d+)/, 1])
end
server = Integer(Docker.version.fetch("Version")[/\d+/, 0])
if local < min_version || server < min_version
raise Docker::Error::VersionError, "Expected docker version to be >= #{min_version}"
end
rescue
warn "Unable to verify local docker!"
Expand Down