dyrector-io/dyrectorio

Add DockerContainer type to docker container builder

Closed this issue · 6 comments

Our docker container builder has a small abstraction misfit, it does a bit more than it should.

A builder builds.

This is issue is a good one for someone who wants to see the Docker Client Golang SDK more closely.

TODO:

  • Keep all the private, With, Without, Create method on builder,
  • Move Start & StartWait, GetContainerID, GetNetworkID to a new type: DockerContainer
  • copy/move all the necessary struct members into the new DockerContainer
  • The container builder should have Create as its last function returning (DockerContainer,error)
  • Consumer of this API will start the container using the methods on DockerContainer
  • Modify the interface accordingly
  • Modify other pieces of code using this checking error every it is used
  • Fix the test you've just broken (:
  • Add the same to tests with the builder (sufficient to add to one test):
// this is a forced interface implementation check
var _ containerbuilder.ExecBuilder = (*containerbuilder.DockerExecBuilder)(nil)

If in doubt don't hesitate to reach us on Discord.

I would like to work on this.

I would like to work on this.

Awesome!

What should the relationship between DockerContainer and DockerContainerBuilder be?
Is there any part that should be extracted from (dc *DockerContainerBuilder) Create()?

I cannot find any reference to interface ContainerBuilder functions. What is this interface for?

I don’t have enough instructions for this issue.
If anybody want to work on it, pls go ahead.

We apologize for not providing more information at that time and thanks for reaching out anyway.
I've opened a PR containing the changes.