Using --network parameter in Docker commands in Bitbucket Pipelines

Platform Notice: Cloud Only - This article only applies to Atlassian products on the cloud platform.

Summary

This article provides insights into the usage of the --network Docker command in Bitbucket Pipelines.

Solution

In Bitbucket Pipelines, the Docker commands can be utilized to create a network within the infrastructure. The following commands demonstrate the process:

  1. Creating a bridge network named "my-test-network":

    1 docker network create -d bridge my-test-network
  2. (Optional) Assigning a subnet to the network:

    1 docker network create -d bridge --subnet=172.28.0.0/16 my-test-network
  3. (Optional) Attaching an IP address to a Docker container within the created network:

    1 docker run -dit --name test-app --ip 172.28.0.22 --network=my-test-network

Notes:

Updated on March 24, 2025

Still need help?

The Atlassian Community is here for you.