Harbor
Harbor Julia package repo.
Harbor.docker_exec
— Methoddocker_exec(container_id::String, exec_cmd::Vector{String}; detach::Bool=false) -> String
Runs docker exec
on the specified container. Returns the command output as a string.
Harbor.docker_images
— Methoddocker_images() -> Vector{Image}
Runs docker images
and returns a vector of Image
structs.
Harbor.docker_inspect_container
— Methoddocker_inspect_container(container_id::String) -> Dict
Runs docker inspect <container_id>
and returns the parsed JSON as a Dict.
Harbor.docker_kill
— Methoddocker_kill(container_id::String; signal::Union{String,Int}="SIGTERM") -> Bool
Runs docker kill --signal=<signal> <container_id>
. Returns true if successful.
Harbor.docker_logs
— Methoddocker_logs(container_id::String; follow::Bool=false, tail::Union{String,Int}="all") -> String
Runs docker logs
with optional follow and tail parameters, returning the log output.
Harbor.docker_ps
— Methoddocker_ps(; all::Bool=false) -> Vector{String}
Runs docker ps
(or docker ps -a
if all is true) and returns a vector of container IDs.
Harbor.docker_pull
— Methoddocker_pull(image_name::String; tag::String="latest") -> Image
Runs docker pull <image_name>:<tag>
. On success, returns an Image
struct.
Harbor.docker_restart
— Methoddocker_restart(container_id::String; timeout::Int=10) -> Bool
Runs docker restart --time=<timeout> <container_id>
. Returns true if successful.
Harbor.docker_rm
— Methoddocker_rm(container_id::String; force::Bool=false) -> Bool
Runs docker rm [--force] <container_id>
. Returns true if the container is removed.
Harbor.docker_rm_image
— Methoddocker_rm_image(image::Image; force::Bool=false) -> Bool
Runs docker rmi [--force] <image>
. Returns true
on success.
Harbor.docker_run
— Methoddocker_run(image::Image; name=nothing, ports=Dict{Int,Int}(),
volumes=Dict{String,String}(), environment=Dict{String,String}(),
command=nothing, detach::Bool=false) -> String
Runs docker run
with the provided options and returns the container ID.
Harbor.docker_start
— Methoddocker_start(container_id::String) -> Bool
Runs docker start <container_id>
. Returns true if successful.
Harbor.docker_stop
— Methoddocker_stop(container_id::String; timeout::Int=10) -> Bool
Runs docker stop --time=<timeout> <container_id>
. Returns true if successful.
Harbor.images
— Methodimages() -> Vector{Image}
Retrieves a list of available images.
Harbor.inspect
— Methodinspect(container::Container) -> Dict
Harbor.logs
— Methodlogs(container::Container) -> String
Retrieves the logs for the specified container.
Harbor.ps
— Methodps(; all::Bool=true) -> Vector{Container}
Lists containers. If all
is true, lists all containers; otherwise, only running ones.
Harbor.pull
— Methodpull(image::String; tag::String="latest") -> Image
Pulls an image from a registry and returns an Image
instance.
Harbor.remove!
— Methodremove!(container::Container) -> Bool
Removes a container from the system. Returns true
if successful.
Harbor.remove
— Methodremove(image::Image; force::Bool=false) -> Bool
Removes the specified image.
Harbor.run!
— Methodrun!(image::Image; name=nothing, ports=Dict{Int,Int}(), volumes=Dict{String,String}(), environment=Dict{String,String}(), command=nothing, detach::Bool=false) -> Container
Starts a container from the provided Image
with the specified options. Returns a Container
instance reflecting the running state.
Harbor.stop!
— Methodstop!(container::Container; timeout::Int=10) -> Container
Gracefully stops a running container. Returns the Container
with a new status.
Harbor.wait_for
— Methodwait_for(container::Container)
Waits until the given strategy condition is met or the timeout expires. Throws an error if the wait condition isn't satisfied in time.
Harbor.with_container
— Methodwith_container(image::Image; kw...) do container # operations on container end
Runs a container with the specified image and keyword options. The container is automatically stopped and removed after the block completes (even if an error occurs).