Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to use multiple docker images in bitbucket pipeline?

I have this pipeline file to unittest my project:

image: jameslin/python-test      pipelines:       default:         - step:             script:               - service mysql start               - pip install -r requirements/test.txt               - export DJANGO_CONFIGURATION=Test               - python manage.py test 

but is it possible to switch to another docker image to deploy?

image: jameslin/python-deploy      pipelines:       default:         - step:             script:                - ansible-playbook deploy 

I cannot seem to find any documentation saying either Yes or No.

like image 991
James Lin Avatar asked Oct 21 '16 00:10

James Lin


People also ask

Can we add multiple images in bitbucket pipeline?

Each step has 4 GB of memory available. A single pipeline can have up to 100 steps. Each step in your pipeline runs a separate Docker container. If you want, you can use different types of containers for each step by selecting different images.

Can you pull multiple Docker images?

By default, docker pull pulls a single image from the registry. A repository can contain multiple images.

Can we store Docker images in bitbucket?

If there is a real need of putting docker image to github/bitbucket you can try to save it into archive (by using https://docs.docker.com/engine/reference/commandline/save/) and commit/push it to your repository.

Can you have multiple Docker images in one container?

In later versions of Docker, it provides the use of multi-stage dockerfiles. Using multi-stage dockerfiles, you can use several base images as well as previous intermediate image layers to build a new image layer.


2 Answers

You can specify an image for each step. Like that:

pipelines:   default:     - step:         name: Build and test         image: node:8.6         script:           - npm install           - npm test           - npm run build         artifacts:           - dist/**     - step:         name: Deploy         image: python:3.5.1         trigger: manual         script:           - python deploy.py 
like image 116
Dmitry Zaytsev Avatar answered Sep 18 '22 14:09

Dmitry Zaytsev


Finally found it:

https://confluence.atlassian.com/bitbucket/configure-bitbucket-pipelines-yml-792298910.html#Configurebitbucket-pipelines.yml-ci_stepstep(required)

step (required) Defines a build execution unit. Steps are executed in the order in which they appear in the pipeline. Currently, each pipeline can have only one step (one for the default pipeline and one for each branch). You can override the main Docker image by specifying an image in a step.

like image 22
James Lin Avatar answered Sep 19 '22 14:09

James Lin