Support running Docker containers (create, start, run) in the build script

Issue #14145 resolved
Joshua Tjhin created an issue

Currently, only build, tag and push commands are supported.

There are use cases to use docker-run so that tests can be run against a built Docker image and docker create so that files/artifacts can be extracted from the container.

Please comment with additional use cases.

Official response

Comments (19)

  1. Michael Miller

    So let me say so far I really do appreciate Bitbucket & specifically Pipelines. Traditionally I've been using Team City and I really appreciate Pipelines as a viable alternative and my hope is to transition completely off Team City + Github into a Bitbucket world. I have been able to implement the Continuous Continuum very well to a point. On check-ins I have a continuous build, continuous integration tests, Continuous documentation (still working through the Bitbucket Wiki not taking in PUTs very well), Continuous performance testing, continuous build and push of docker image (AWESOME), but ideally the last step is to push this new docker image to a an existing swarm (in my case azure) and for that I need some more docker commands than login, build, & push... I need run. :)

  2. Aneita Yang

    Use case from Issue #14739:

    I'm using Bitbucket Pipelines to build my docker image. When building the Dockerfile it produces a few artefacts within the image, which I would like to extract and work with in the next step of the pipeline. So how I thought I would do it would be to do a "docker create" and then "docker cp", however, the create command is not supported in pipelines.

  3. Przemysław Furtak

    What is a status of the issue? Command docker run generally has to be added. It's included into GitlabCI, TravisCI. How I can prepare an image, run some commands, commit and then push a new image to AWS ECS or anywhere? It's impossible in the current version.

  4. Aneita Yang

    Hi everyone,

    Thanks for all of the feedback and the interest in this issue. We're currently investigating the work that is required to support docker run. I'll keep you updated on our progress via this issue.

  5. Peter Roth

    Our builds also require the ability to run docker images for testing of the docker image the build itself produces. After building the new image (HTTP API in our case) we set up external dependencies such as our other APIs not produced in this API (real or mocks via docker), DBs such as postgresql, etc required to test. We also need to setup docker networks to connect the containers as well to do this which I'm not sure is covered as part of this issue or not.

  6. Matt Ryall

    @Przemyslaw Furtak - docker push has been available in Pipelines since April. docker exec will now work for running commands in containers that you start, but you cannot use --privileged. All commands should work except for swarm commands and --privileged, with the caveats around volume mapping mentioned on the page.

  7. Log in to comment