Running a Docker container in Bamboo

このページの内容

お困りですか?

アトラシアン コミュニティをご利用ください。

コミュニティに質問

By default, the task's working directory is mounted and used as the Docker container's working directory, but you can specify your own settings.

By default, the container is removed on completion of the task, but you can select Detach container to have the container continue to run after a deployment project completes. Containers can be linked to detached containers started by preceding tasks in a job by selecting the Link to detached containers option.

Note that a non-detached container that fails to start will not be removed when the Bamboo task completes. See this KB article for more details.

はじめる前に

  • 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.

Bamboo で Docker コンテナを実行するには:

  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. Select the Run a Docker container command and complete the settings. See more information about the settings below:

    Docker コンテナの実行...
    Docker イメージ 

    Run a Docker image option in Docker task configuration


    The image you want to use to instantiate the Docker container.
    コンテナをデタッチ

    Allows you to run the container in the background, after a deployment project completes.

    Specify a Container name that isn't used by other containers in this job.

    Select Add port mapping to specify mappings that bind ports inside the container to ports on the host.

    サービスの開始を待つ

    サービスを利用できるようになるまで Bamboo が待機する時間を指定できます。

    Bamboo が確認する URL のパターンとタイムアウト期間を指定する必要があります。

    デタッチ コンテナへのリンク
    コンテナを、ジョブの先行タスクで開始したデタッチ コンテナへリンクさせることができます。
    コンテナ環境変数

    Allows you to specify parameters to pass to the container, for example JAVA_OPTS="-Xmx256m -Xms128m".

    複数のパラメーターはスペースで区切ってください。スペースを使用したパラメーターには引用符を付ける必要があります。

    コンテナ コマンド
    Docker コンテナを実行するためのコマンド。
    Container working directory
    The working directory for the container.
    Additional arguments

    Additional Docker run options.

    Argument strings that have values which contain spaces require the entire argument string be contained within quotes, that is, the parameter marker, the parameter, the equals sign, and the value containing spaces. For example:

    "--health-cmd=mysqladmin ping || exit 1"
    Volumes

    You can mount additional host directories as data volumes inside the container.


    必要に応じて、詳細オプションを指定します。 

    環境変数
    (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!

最終更新日 2021 年 8 月 17 日

この内容はお役に立ちましたか?

はい
いいえ
この記事についてのフィードバックを送信する
Powered by Confluence and Scroll Viewport.