Skip to content

AutoRemove field is not populated in container. #1166

Closed
@JShrein

Description

@JShrein

From #1050 it seems support for AutoRemove was added and commit 0f4647d was merged, however setting this value in HostConfig does not seem to populate the AutoRemove field in the container.

ExposedPort tcp22 = ExposedPort.tcp(22);
ExposedPort tcp23 = ExposedPort.tcp(23);

Ports portBindings = new Ports();
portBindings.bind(tcp22, Binding.bindPort(baseport + 22));
portBindings.bind(tcp23, Binding.bindPort(baseport + 23));
portBindings.bind(tcp23, Binding.bindPort(baseport + 24));
		
CreateContainerCmd createContainerCmd = dockerClient.Client()
    .createContainerCmd("testimage")
        .withHostConfig(new HostConfig()
	    .withPortBindings(portBindings)
	    .withAutoRemove(true));
createContainerCmd.exec();

Relevant section taken from docker inspect. Other fields, such as port bindings, are properly populated, but not the AutoRemove field.

"HostConfig": {
    "Binds": null,
    "ContainerIDFile": "",
    "LogConfig": {
        "Type": "json-file",
        "Config": {}
    },
    "NetworkMode": "default",
    "PortBindings": {
        "22/tcp": [
            {
                "HostIp": "",
                "HostPort": "8042"
            }
        ],
        "23/tcp": [
            {
                "HostIp": "",
                "HostPort": "8043"
            },
            {
                "HostIp": "",
                "HostPort": "8044"
            }
        ]
    },
    "RestartPolicy": {
        "Name": "",
        "MaximumRetryCount": 0
    },
    "AutoRemove": false,
    ...

Also, I don't believe there is any test coverage for this particular feature.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions