Skip to content

Design issues with BoundHostVolumes #43

@EronWright

Description

@EronWright

A recent commit introduced support for defining host-bound volumes (e796c76). A design issue around the overloaded use of the BoundHostVolumes type has led to hacky and incomplete support for inspecting containers that contain volumes.

For background, running a Docker container involves two API calls, createContainer(ContainerConfig) and startContainer(HostConfig). Bound host volumes are partially defined in ContainerConfig and partially defined in HostConfig. Commit e796c76 strives to use a single type - BoundHostVolumes - as the property type within both ContainerConfig and HostConfig. The solution is non-functional - inspectContainer is broken and incomplete.

I propose we:

  • introduce new inner types ContainerConfig.Volumes and HostConfig.Binds that serialize/deserialize naturally.
  • re-imagine BoundHostVolumes as a 'builder' type that generates Volumes and Binds objects.
  • deprecate ContainerConfig#getVolumes and introduce a new property, getVolumes2 that returns an instance of Volumes. This is to avoid a breaking change.
  • deprecate HostConfig.getBinds and introduce a new property, getBinds2 that returns an instance of Binds. This is to avoid a breaking change.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions