Teradata Package for R Function Reference | 17.00 - 17.00 - td_setup_sandbox_env - Teradata Package for R

Teradata® Package for R Function Reference

Teradata Package for R
Release Number
Release Date
July 2021
Content Type
Programming Reference
Publication ID
English (United States)


Function to either load sandbox image and start a new docker container by passing the "sandbox.image.location" and "sandbox.image.name" or start an existing container using the argument "container".

  1. Teradata recommends to run this function once before running td_test_script() on object of class "ScriptTableOperator".

  2. Sandbox image loading on user's system is skipped if the image with the same name is already loaded.

  3. There can be only one container started from within tdplyr at any given point.

  4. At the end of the session, image loaded and/or container started by the function is cleaned up. If the image loading is skipped, then the image is not cleaned up.

  5. Use td_cleanup_sandbox_env() to manually cleanup image/container started by the function. If the image loading is skipped, then the image is not cleaned up.

  6. User should be careful while providing "sandbox.image.location" and "sandbox.image.name". If an incorrect "sandbox.image.name" (that does not match the name and/or tag of the image) is provided, then:

    1. The image will not be loaded. User should re-run the function with correct "sandbox.image.name".

    2. If the user's system already has an image with the image name and tag same as the image specified in "sandbox.image.location", then image loading is skipped.


  sandbox.image.location = NULL,
  sandbox.image.name = NULL,
  container = NULL



Optional Argument.
Specifies the path to the sandbox image on user's system.

  1. Refer to Teradata Package for R User Guide for location to download sandbox image.

  2. After loading the image, a container is created and started.

  3. "sandbox.image.location" and "sandbox.image.name" must be specified together.

Types: character


Optional Argument.
Specifies the name of the sandbox image that should be used for generating the image. This is used for starting a container.

  1. "sandbox.image.location" and "sandbox.image.name" must be specified together.

  2. If the "sandbox.image.name" is incorrect, then the image is not loaded.

Types: character


Optional Argument. Required if "sandbox.image.location" and "sandbox.image.name" are not specified.
Specifies the name/id of an existing docker container.

  • User should be careful while specifying this argument. If this argument is specified to start the container, then this container is cleaned up at the end of the session.

Types: character


TRUE, invisibly.


# Get remote data source connection.
con <- td_get_context()$connection

# Example 1: Load the image from the location specified in
#            "sandbox.image.location" argument and start a container.
#            This is useful when the user wants to run user scripts in a new
#            container created from a new docker image.
td_setup_sandbox_env(sandbox.image.location = "<path_to_docker_image>",
                     sandbox.image.name = "rstosandbox:1.0")

# Example 2: Start an existing container specified in "container" argument.
#            This is useful when the user wants to run user script in an
#            existing container.
td_setup_sandbox_env(container = "<container_name_or_id>")