Examples

Simple Example

using DockerSandbox

config = DockerConfig(; base_image = "julia:latest");

with_container() do container
    code = """
    println("Hello world!")
    """
    run(container, config, `julia -e $(code)`)
end
Process(`docker run --security-opt=no-new-privileges --cap-drop=all --interactive --label org.julialang.docker.jl=VJ6pjplhDn --rm=true --workdir=/home/myuser julialang_dockerjl:julia_latest_16f8b5d9 julia -e 'println("Hello world!")
'`, ProcessExited(0))

Interactive Example

julia> using DockerSandbox

julia> config = DockerConfig(;
           base_image = "julia:latest",
           Base.stdin,
           Base.stdout,
           Base.stderr,
       );

julia> with_container() do container
           run(container, config, `/bin/bash`)
       end