Stop and remove containers

Modified: 08 Sep 2022 04:28 UTC

Watch the screencast

Watch the video to see triton-docker stop and triton-docker rm in action.

Stop containers

With triton-docker stop, a container is given a graceful shutdown. This could be useful if your container is not responsive, or if you need to restart the container in order to upgrade or migrate to another host.

Docker automatically gives your container 10 seconds to stop, and if it does not comply, the process is forcibly killed. It is possible to allocate a specific amount of time for the shutdown by adding --time=<seconds> before the container name. For example, triton-docker stop --time=30 <container name> would give the container 30 seconds to stop gracefully before it is forcibly killed.

The companion triton command, triton instance stop, is similar to triton-docker stop and will stop your instances.

Remove containers

To remove a container you're no longer using (and has been previously stopped), execute triton-docker rm <container name>. If you want to remove a container that is not already stopped, you can force stop and remove the container with triton-docker rm -f <container name>.

On Triton, triton instance delete <container name> can remove any container, including Docker containers.

You will be billed for all provisioned containers, including those which are stopped. To avoid charges for containers which you may no longer be using, be sure to remove them.