# Codehaus Cargo : Container Stop

Created by Former user, last modified on Nov 15, 2006

### Definition

Stop a running container

This feature is only available for local containers

Note: The stop action waits till the container is fully stopped before returning.

### Example using the Java API

Stopping Orion 1.x:

    InstalledLocalContainer container = new Orion1xInstalledLocalContainer(
        new OrionStandaloneConfiguration("target/orion1x"));
    container.setHome("c:/apps/orion-1.6.0b");

    container.stop();

### Example using the Ant API

Stopping Orion 1.x:

    <cargo refId="mycontainerid" home="c:/apps/orion-1.6.0b" action="stop"/>

Note that if you use the `refid` attribute you'll need to have defined it using an `id` attribute when you started the container. For example:

    <cargo id="mycontainerid" [...] action="start">
      [...]
    </cargo>
    <cargo refid="mycontainerid" [...] action="stop"/>

Alternatively you could specify a full configuration if you don't want to use the `refid` attribute.