public ContainerDefinition withExtraHosts(java.util.Collection<HostEntry> extraHosts) {
        setExtraHosts(extraHosts);
        return this;
    }
<p>
A list of hostnames and IP address mappings to append to the <code>/etc/hosts</code> file on the container. This
parameter maps to <code>ExtraHosts</code> in the <a
href="https://docs.docker.com/engine/api/v1.35/#operation/ContainerCreate">Create a container</a> section of the
<a href="https://docs.docker.com/engine/api/v1.35/">Docker Remote API</a> and the <code>--add-host</code> option
to <a href="https://docs.docker.com/engine/reference/run/#security-configuration">docker run</a>.
</p>
<note>
<p>
This parameter isn't supported for Windows containers or tasks that use the <code>awsvpc</code> network mode.
</p>
</note>

@param extraHosts
       A list of hostnames and IP address mappings to append to the <code>/etc/hosts</code> file on the
       container. This parameter maps to <code>ExtraHosts</code> in the <a
       href="https://docs.docker.com/engine/api/v1.35/#operation/ContainerCreate">Create a container</a> section
       of the <a href="https://docs.docker.com/engine/api/v1.35/">Docker Remote API</a> and the
       <code>--add-host</code> option to <a
       href="https://docs.docker.com/engine/reference/run/#security-configuration">docker run</a>.</p> <note>
       <p>
       This parameter isn't supported for Windows containers or tasks that use the <code>awsvpc</code> network
       mode.
       </p>
@return Returns a reference to this object so that method calls can be chained together.
aws-java-sdk-ecs/src/main/java/com/amazonaws/services/ecs/model/ContainerDefinition.java