Run a Docker Container

Octopus.DockerRun exported 2026-07-22 by Octopus Deploy belongs to ‘Docker’ category.

Run a Docker Container sourced from a Container Registry.

Parameters

When this step is included in a project’s deployment process, the parameters below can be set.

Docker Image

Octopus.Action.Package.PackageId (required)

The Docker image to run. This step is used to run a docker container sourced from a container registry.

Example: my-app:latest

Feed

Octopus.Action.Package.FeedId (required)

The container registry feed from which the Docker image will be sourced.

Example: feeds-docker-hub

Network Type

Octopus.Action.Docker.NetworkType

Connect a container to a network.

Allowed values: “, none, bridge, host, container, network

Container name or ID

Octopus.Action.Docker.NetworkContainer

Use the network stack of another container, specified via its name or id. Only applicable when Network Type is ‘container’.

Network name or ID

Octopus.Action.Docker.NetworkName

Connects the container to a user created network. Only applicable when Network Type is ‘network’.

Network alias

Octopus.Action.Docker.NetworkAlias

Add network-scoped alias for the container. Only applicable when Network Type is ‘network’.

Port Mapping

Octopus.Action.Docker.PortMapping

Publish a container’s port or a range of ports to the host. Specified as a JSON object mapping container ports to host ports.

Example: {"8080":"80"}

Automatically map to ephemeral port

Octopus.Action.Docker.PortAutoMap

Allows mapping exposed network port in the container to ports on the host.

Allowed values: True, False

Default: False

Host Entry

Octopus.Action.Docker.AddedHost

Adds a line to /etc/hosts. Specified as a JSON object mapping IP addresses to host names.

Example: {"127.0.0.1":"myhost"}

Bind Mounts

Octopus.Action.Docker.VolumeBindings

A data volume is a specially-designated directory within one or more containers that bypasses the Union File System. Specified as a JSON object mapping container paths to host path, readOnly, and noCopy settings.

Example: {"/container/path":{"host":"/host/path","readOnly":"False","noCopy":"False"}}

Volume Driver

Octopus.Action.Docker.VolumeDriver

Optional volume driver for the container.

Volumes From

Octopus.Action.Docker.VolumesFrom

Mount all volumes from the given container(s). Specified as a comma-separated list of container names.

Example: container1,container2

Explicit Variable Mapping

Octopus.Action.Docker.EnvVariable

Passes through variables into the container accessible as environment variables. Specified as a JSON object mapping variable names to values.

Example: {"ENV_VAR":"value"}

Restart Policy

Octopus.Action.Docker.RestartPolicy

Restart policy to apply when a container exits.

Allowed values: no, on-failure, always, unless-stopped

Default: no

Maximum retry count

Octopus.Action.Docker.RestartPolicyMax

Maximum number of retry attempts to start a container. Only applicable when Restart Policy is ‘on-failure’.

Example: 4

Don’t Auto-run

Octopus.Action.Docker.DontRun

Perform ‘create’ command instead of ‘run’. This creates the writable layer on top of the image and prepares it for running without actually starting it.

Allowed values: True, False

Default: False

Command

Octopus.Action.Docker.Command

Override default CMD instruction provided by the image.

Example: echo env

Additional Arguments

Octopus.Action.Docker.Args

Additional arguments that will be passed to the docker run command.

Example: -P -e key=value

Step configuration using OCL

Example in Octopus Configuration Language (OCL):

step "run-docker-container" {
    name = "Run Docker Container"
    properties = {
        Octopus.Action.TargetRoles = "docker-host"
    }

    action {
        action_type = "Octopus.DockerRun"
        properties = {
            Octopus.Action.Docker.DontRun = "False"
            Octopus.Action.Docker.NetworkType = "bridge"
            Octopus.Action.Docker.PortAutoMap = "True"
            Octopus.Action.Docker.RestartPolicy = "unless-stopped"
            Octopus.Action.Package.DownloadOnTentacle = "False"
            Octopus.Action.Package.FeedId = "docker-hub"
            Octopus.Action.Package.PackageId = "myorg/myimage"
            Octopus.Action.RunOnServer = "false"
        }

        packages {
            acquisition_location = "Server"
            feed = "docker-hub"
            package_id = "myorg/myimage"
        }
    }
}

Page updated on Wednesday, July 22, 2026