diff --git a/rebar.config b/rebar.config index 7fdb99d..d4d9bc6 100644 --- a/rebar.config +++ b/rebar.config @@ -31,7 +31,7 @@ {deps, [ {sync, ".*", {git, "https://github.com/rustyio/sync.git", {branch, "master"}}}, - {jiffy, ".*", {git, "https://github.com/davisp/jiffy.git", {tag, "1.1.2"}}}, + {jiffy, ".*", {git, "https://github.com/davisp/jiffy.git", {tag, "1.1.3"}}}, {cowboy, ".*", {git, "https://github.com/ninenines/cowboy.git", {tag, "2.10.0"}}}, {gun, ".*", {git, "https://github.com/ninenines/gun.git", {tag, "2.2.0"}}} ]}. diff --git a/src/docker/docker_commands.erl b/src/docker/docker_commands.erl index 5a1c6de..f054125 100644 --- a/src/docker/docker_commands.erl +++ b/src/docker/docker_commands.erl @@ -23,11 +23,13 @@ pull_image(Image, Callback) when is_binary(Image), is_function(Callback, 1) -> -spec check_image_exist(Image :: binary()) -> boolean(). check_image_exist(Image) when is_binary(Image) -> - Url = lists:flatten(io_lib:format("/images/~s/json", [binary_to_list(Image)])), + EncodedImage = uri_string:quote(Image), + Url = lists:flatten(io_lib:format("/images/~s/json", [binary_to_list(EncodedImage)])), case docker_http:request("GET", Url, <<"">>, []) of - {ok, 200, _Headers, Resp} -> - M = catch jiffy:decode(Resp, [return_maps]), - is_map(M) andalso maps:is_key(<<"Id">>, M); + {ok, 200, _Headers, _Resp} -> + true; + {ok, 404, _, _} -> + false; _ -> false end.