-
Notifications
You must be signed in to change notification settings - Fork 5
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
Use the Go API to spawn the docker image? #6
Comments
This is a great consideration! We are already loosely coupling our code with the docker CLI API, so the question is do you think the golang docker API is more likely to change with higher frequency than the docker CLI API? My unsubstantiated guess is that the CLI and golang APIs will likely change in tandem (approximately at least) so it might be more efficient and clean to just choose the golang API. |
That's a good point that the various APIs probably move somewhat in tandem. Maybe? encouraging info from the docs:
|
@frenata i've been working with the Docker golang API in another project and I'm p familiar with who it works etc. now, I totally wouldn't mind taking on a small refactor to leverage this API instead of using If this sounds alright, I could make a feature branch and get to work on this :) |
Sounds great, I think this will make the code "more complicated" but also better. Calling out to |
Notes: * create godoc during this refactor and remove `docs.md`
Notes: * create godoc during this refactor and remove `docs.md`
Major Changes: * connect to docker client in #newSandbox constructor * break up #prepare into #PrepareTmpDir and #PrepareContainer * implement #PrepareContainer for setting up sandbox docker container * refactor #execute to start docker container and wait for completion * return errors from all sandbox methods rather than logging errors (this way, calling function can decide how to proceed on error) * assign sandbox ID corresponding to container id * create tmpDirPrefix constant * add docstrign comments Todos: * must include test coverage.
As it stands, the code is a pretty ugly hack translated near directly from the old node implementation:
(and later)
It seems strange to fall back to the OS and a bash script to communicate to another process written in the same language, which seems to provide a healthy API.
On the other hand, interacting directly with the docker API might constrain the environments in which compilebox can run, requiring some amount of coupling between the host's version of
docker
and the API target of compilebox.https://docs.docker.com/develop/sdk/examples/ may be useful reading as well.
The text was updated successfully, but these errors were encountered: