Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docker run #4

Open
benbro opened this issue Sep 16, 2013 · 1 comment
Open

docker run #4

benbro opened this issue Sep 16, 2013 · 1 comment

Comments

@benbro
Copy link

benbro commented Sep 16, 2013

It could be useful to have an equivalent to the docker run command
http://docs.docker.io/en/latest/commandline/command/run/
docker_container:run/3 will run a command in a container and gives back the output, possibly warnings and errors too.

Create a container and run a command:
docker_container:run(Cmd, Options)

Run a command in existing container:
docker_container:run(CID, Cmd, Options)

Cmd = binary/string of the command to execute
Options = proplist of options similar to what docker run has.

In addition we could add
{timeout, Timeout} Kill the container if it doesn't respond after Timeout.
{delete, true} Delete the container after executing the command

This could be implemented using:
docker_container:create/1 in case we want to also create a new container.
docker_container:start/2 Start the container
docker_container:wait/1 Wait for the container to exit. Here we can use a timeout too.
docker_container:attach_stream/1 will collect the output.
docker_container:stop/1 or docker_container:kill at the end.

@proger
Copy link
Owner

proger commented Sep 16, 2013

I'm looking to implement this feature later.

Right now you can have this functionality through erlsh:

> erlsh:run([erlsh:fdlink_executable(), "/bin/sh", "-c", "docker run base echo hi"]).
{done,0,<<"hi\n">>}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants