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, [ {deps, [
{sync, ".*", {git, "https://github.com/rustyio/sync.git", {branch, "master"}}}, {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"}}}, {cowboy, ".*", {git, "https://github.com/ninenines/cowboy.git", {tag, "2.10.0"}}},
{gun, ".*", {git, "https://github.com/ninenines/gun.git", {tag, "2.2.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(). -spec check_image_exist(Image :: binary()) -> boolean().
check_image_exist(Image) when is_binary(Image) -> 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 case docker_http:request("GET", Url, <<"">>, []) of
{ok, 200, _Headers, Resp} -> {ok, 200, _Headers, _Resp} ->
M = catch jiffy:decode(Resp, [return_maps]), true;
is_map(M) andalso maps:is_key(<<"Id">>, M); {ok, 404, _, _} ->
false;
_ -> _ ->
false false
end. end.