Pushing a Docker image to a registry

On this page

Still need help?

The Atlassian Community is here for you.

Ask the community

You can push a Docker image to a Docker registry. This may be the central Docker Hub registry or a custom registry.

Before you begin

  • Make sure you have Docker installed. We advise to use the most recent version. 
  • Define a Docker capability in Bamboo. See Defining a new Docker capability

  • If you're using Bamboo on Windows, you can't run Docker commands directly from the Windows command line. To use Docker tasks with Bamboo Windows, run Docker Machine.

To push a Docker repository from Bamboo to a registry:

  1. In the job configuration screen, select Add task.
  2. Search for the Docker tasks type and select it.
  3. (optional) For future reference, add a Task description.
  4. (optional) Use the Disable this task checkbox to control whether your task gets run.
  5. (optional) Use the Add condition to task checkbox to make task run only when a certain condition is met. 
    You can find conditions on Atlassian Marketplace or implement your own.  
  6. From the Repository drop-down list, select Push a Docker image to a Docker registry.
  7. Complete the settings:

    Push a Docker image to a Docker registry...
    Registry

    Push a Docker image to a registry option in Docker task configuration

    Select to push to either Docker Hub or a custom registry.
    Repository

    For Docker Hub you must specify the repository name and optionally a tag, for example: namespace/repository:tag

    For a custom registry you must specify the registry address, repository name and optionally a tag, for example: registry.address:port/namespace/repository:tag

    Authentication type

    Select how you'd like to authenticate:

    • use agents' dockercfg file
    • use username and password
    • select predefined shared credentials from the drop-down list


    If required, specify advanced options: 

    Environment variables
    (Optional) Additional system environment variables that you want to pass to your build. Note that existing environment variables are automatically available to the executable. You can also include Bamboo global or build-specific variables (see Bamboo variables).
    Multiple variables should be separated with spaces. Parameters with spaces must be quoted (e.g JAVA_OPTS="-Xms200m -Xmx700m").
    Working subdirectory
    (Optional) An alternative subdirectory, relative to the job's root directory, where Bamboo will run the executable. The root directory contains everything checked out from the job's configured source repository. If you leave this field blank, Bamboo will look for build files in the root directory. This option is useful if your task has a build script in a subdirectory and the executable needs to be run from within that subdirectory.


    Save your changes!

Last modified on Dec 15, 2021

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.