Skip to main content

Run Sauce Connect in Docker

Sauce Connect Proxy container images are available on Docker Hub.

Pull image

The easiest way to get started with Sauce Connect Proxy in Docker is to pull the latest version of the image from Docker Hub.

docker pull saucelabs/sauce-connect

You can also specify a specific version by using a tag.

docker pull saucelabs/sauce-connect:<tag>

Check this list of supported tags.

Configure and run

Sauce Connect Proxy can be configured using:

  • Configuration file,
  • Environment variables,
  • Command line arguments.

All of these options are supported in containers, and you can use them interchangeably.

note

At the moment api-address may only be specified as environment variable SAUCE_API_ADDRESS, and not in the configuration file. See Sauce Connect Proxy API Server for more information.

Configuration file

To use a configuration file, mount the file to the container at /etc/sauce-connect/sauce-connect.yaml.

docker run \
-v /path/to/config.yaml:/etc/sauce-connect/sauce-connect.yaml \
saucelabs/sauce-connect

Environment variables

You can also configure Sauce Connect Proxy using environment variables. The following example demonstrates how to run the container using environment variables.

docker run \
-e SAUCE_USERNAME="<usename>" \
-e SAUCE_ACCESS_KEY="<access-key>" \
-e SAUCE_REGION="<region>" \
-e SAUCE_TUNNEL_NAME="<tunnel-name>" \
saucelabs/sauce-connect

Command line arguments

To pass command line arguments, use the sc command followed by the desired arguments.

docker run saucelabs/sauce-connect run \
--username=<username> \
--access-key=<access-key> \
--region=<region> \
--tunnel-name=<tunnel-name>

Mix and match

It is also possible to mix and match the configuration options. For instance, you can use a configuration file for all the common settings and override some of them using environment variables. The order of precedence is as follows:

  1. Command line arguments
  2. Environment variables
  3. Configuration file

The following example demonstrates how to use a configuration file and provide username and access key using environment variables.

docker run \
-e SAUCE_USERNAME="<usename>" \
-e SAUCE_ACCESS_KEY="<access-key>" \
-v /path/to/config.yaml:/etc/sauce-connect/sauce-connect.yaml \
saucelabs/sauce-connect

Logs

Logs are handled automatically by Docker, and you can use the docker logs command to access them. To access logs:

  1. Find the container ID.

    docker ps
  2. Use the container ID to get the logs.

    docker logs <container-id>

Health checks

The docker container has a built-in health check that can be used to determine if the tunnel is ready to accept jobs. You should see the container status as healthy in docker ps when the tunnel is ready. See Sauce Connect Proxy Readiness Checks for more information.

Additional Resources