This commit is contained in:
anlicheng 2026-04-23 15:32:30 +08:00
parent d3a00129fa
commit 801ff36d09
2 changed files with 7 additions and 5 deletions

View File

@ -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"}}}
]}.

View File

@ -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.