This function used a locally defined `configWrapper`, which was identical
to the `container.CreateRequest`, with the exception of `CreateRequest`
defining `omitempty` for HostConfig and NetworkingConfig, but this should
not impact our use as the same type is used to handle the request on the
daemon side.
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
| ... | ... |
@@ -12,12 +12,6 @@ import ( |
| 12 | 12 |
ocispec "github.com/opencontainers/image-spec/specs-go/v1" |
| 13 | 13 |
) |
| 14 | 14 |
|
| 15 |
-type configWrapper struct {
|
|
| 16 |
- *container.Config |
|
| 17 |
- HostConfig *container.HostConfig |
|
| 18 |
- NetworkingConfig *network.NetworkingConfig |
|
| 19 |
-} |
|
| 20 |
- |
|
| 21 | 15 |
// ContainerCreate creates a new container based on the given configuration. |
| 22 | 16 |
// It can be associated with a name, but it's not mandatory. |
| 23 | 17 |
func (cli *Client) ContainerCreate(ctx context.Context, config *container.Config, hostConfig *container.HostConfig, networkingConfig *network.NetworkingConfig, platform *ocispec.Platform, containerName string) (container.CreateResponse, error) {
|
| ... | ... |
@@ -74,7 +68,7 @@ func (cli *Client) ContainerCreate(ctx context.Context, config *container.Config |
| 74 | 74 |
query.Set("name", containerName)
|
| 75 | 75 |
} |
| 76 | 76 |
|
| 77 |
- body := configWrapper{
|
|
| 77 |
+ body := container.CreateRequest{
|
|
| 78 | 78 |
Config: config, |
| 79 | 79 |
HostConfig: hostConfig, |
| 80 | 80 |
NetworkingConfig: networkingConfig, |
| ... | ... |
@@ -77,7 +77,7 @@ func TestContainerCreateWithName(t *testing.T) {
|
| 77 | 77 |
func TestContainerCreateAutoRemove(t *testing.T) {
|
| 78 | 78 |
autoRemoveValidator := func(expectedValue bool) func(req *http.Request) (*http.Response, error) {
|
| 79 | 79 |
return func(req *http.Request) (*http.Response, error) {
|
| 80 |
- var config configWrapper |
|
| 80 |
+ var config container.CreateRequest |
|
| 81 | 81 |
|
| 82 | 82 |
if err := json.NewDecoder(req.Body).Decode(&config); err != nil {
|
| 83 | 83 |
return nil, err |