Skip to contents

This function removes Docker containers and optionally images created by the shinydocker package. It can target a specific application or clean up all shinydocker-created containers and images.

Usage

cleanup_container(
  app_dir = NULL,
  remove_images = FALSE,
  include_running = FALSE,
  force = FALSE,
  prune = FALSE,
  quiet = FALSE,
  ...
)

Arguments

app_dir

Character. Path to the Shiny application directory. If provided, only containers/images related to this application will be removed. If NULL, all containers/images created by shinydocker will be considered.

remove_images

Logical. If TRUE, also remove Docker images after removing containers. Default: FALSE.

include_running

Logical. If TRUE, stop and remove running containers. If FALSE, only stopped containers will be removed. Default: FALSE.

force

Logical. If TRUE, force removal without confirmation. Default: FALSE.

prune

Logical. If TRUE, run docker system prune after cleanup to remove unused data. Default: FALSE.

quiet

Logical. If TRUE, suppress Docker command output. Default: FALSE.

...

Additional arguments passed to processx.

Value

Invisibly returns a list with counts of removed containers and images.

Examples

if (FALSE) { # \dontrun{
# Clean up containers for a specific app
cleanup_container("path/to/my/shinyapp")

# Clean up all shinydocker containers and images
cleanup_container(remove_images = TRUE)

# Force cleanup of all containers including running ones
cleanup_container(include_running = TRUE, force = TRUE)
} # }