# Store Docker images in Bitbucket with Bitbucket Packages | Bitbucket Blitz | Atlassian

Source: https://www.youtube.com/watch?v=gQcR_dh8hxI
Recap page: https://rapidrecap.app/video/gQcR_dh8hxI
Generated: 2025-12-10T18:36:05.278+00:00

---
## Quick Overview

Bitbucket Packages functions as a native Docker Registry within Bitbucket, allowing users to store Docker images alongside their source code and CI/CD pipelines to improve developer experience, simplify the tech stack, lower costs, and reduce security risks by consolidating tools.

**Key Points:**
- Bitbucket Packages serves as a Docker Registry integrated directly within Bitbucket, enabling storage of Docker images alongside code and CI/CD pipelines.
- Integrating image hosting improves Developer Experience (DevEx) by managing containers within the familiar Bitbucket environment.
- The feature results in a simpler stack and lower costs by eliminating the need for external, separate container registries and reducing tool maintenance overhead.
- Security is enhanced by reducing the overall tool surface area, leading to fewer potential attack vectors and less complex permission management.
- The demonstration shows configuring a `bitbucket-pipelines.yml` file to build a C++ image using an Alpine base and pushing it to the Bitbucket Package registry using environment variables for authentication.
- Permissions for package access (like the demonstrated `cpp-build-image`) are managed directly within Bitbucket, simplifying user and permission wrangling compared to external tools.
- Users can create multiple packages per repository and manage them via the dedicated 'Packages' section in the left navigation bar.

![Screenshot at 00:19: The slide summarizing the three main benefits of Bitbucket Packages: Improved DevEx, Simpler Stack/Lower Costs, and Reduced Risk, visually represented by icons.](https://ss.rapidrecap.app/screens/gQcR_dh8hxI/00-00-19.png)

**Context:** This video, part of the Atlassian Bitbucket Blitz series, demonstrates how Bitbucket Packages can be utilized as a built-in Docker Registry. The presenter explains the advantages of this integration, focusing on streamlining workflows by keeping code, pipelines, and container images in one place, which is crucial for modern DevOps practices.

## Detailed Analysis

Bitbucket Packages acts as a native Docker Registry within Bitbucket, allowing users to store Docker images directly alongside their source code and CI/CD configurations. This consolidation offers three primary benefits: improved Developer Experience (DevEx) by managing container images within Bitbucket pipelines; a simpler stack and lower costs by removing the need for external registries; and reduced risk due to a smaller attack surface and simplified permission management. The presenter walks through setting up a pipeline to build a Docker image for a C++ project. The pipeline configuration (`bitbucket-pipelines.yml`) requires an `image` definition pointing to the Bitbucket registry endpoint (e.g., `cr.app.gcr.io/atlassian-wcsd/cpp-build-image:latest`), along with environment variables for username (using the Atlassian email) and password (using an API token). The pipeline steps include building the image and then pushing it to the Bitbucket Package registry. After a successful pipeline run, the newly pushed image appears in the 'Packages' section of the repository. The presenter navigates to this section (01:31), showing the `cpp-build-image` package created an hour ago. The video further shows that users can create multiple packages per repository and manage them, including viewing tags (like 'latest') and accessing options to copy the pull command or delete the tag/package. The presenter also contrasts this setup with a previous example repository where the pipeline used an Alpine base image and required explicit `docker login` commands, demonstrating how the native registry setup streamlines authentication.

### Bitbucket Packages Value Proposition

- Improve DevEx by managing container images alongside code and CI/CD pipelines
- Simpler stack/Lower costs by reducing external registry needs
- Reduce Risk via smaller attack surface and less permission wrangling

### Docker Image Build & Push Configuration

- Requires a Dockerfile for image definition (e.g., using Alpine base)
- Bitbucket Pipelines YAML must define the image name pointing to the registry (e.g., cr.app.gcr.io/...)
- Authentication uses BITBUCKET_USERNAME (email) and BITBUCKET_PASSWORD (API_TOKEN) environment variables for login and push

### Package Management Demonstration

- Navigating to the 'Packages' tab shows existing images like 'cpp-build-image'
- Newly pushed images appear instantly with tag, digest, and push details
- Users can create multiple packages per repository and manage tags/deletions from this view

![Screenshot at 00:00: Title slide for the video explaining that Bitbucket Packages is a Docker Registry in Bitbucket for storing Docker images alongside code and CI/CD.](https://ss.rapidrecap.app/screens/gQcR_dh8hxI/00-00-00.png)
![Screenshot at 00:19: Slide detailing the three core benefits of using Bitbucket Packages: Improve DevEx, Simpler stack/Lower costs, and Reduce Risk.](https://ss.rapidrecap.app/screens/gQcR_dh8hxI/00-00-19.png)
![Screenshot at 00:54: Viewing the Dockerfile within the repository, which defines the base image \(Alpine:latest\) and required build tools for a C++ application.](https://ss.rapidrecap.app/screens/gQcR_dh8hxI/00-00-54.png)
![Screenshot at 01:08: Viewing the bitbucket-pipelines.yml file showing the script section that logs into the registry using API tokens and then runs docker build and docker push commands to the Bitbucket Package registry.](https://ss.rapidrecap.app/screens/gQcR_dh8hxI/00-01-08.png)
![Screenshot at 02:13: The Packages view within the repository showing the newly created 'cpp-build-image2' package pushed seconds ago, alongside the older 'cpp-build-image'.](https://ss.rapidrecap.app/screens/gQcR_dh8hxI/00-02-13.png)
