Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,298,464
Community Members
 
Community Events
165
Community Groups

Bitbucket CI not running my script within the step when using a custom docker container

Edited

We have a custom docker container we are using for testing and building, but the script in the first step its not executing, it just tells me that it did the build setup and build teardown but nothing else... I tried so set a workdir (/root) in the container, put most apt commands in one RUN command but to no avail, 

What baffles me the most is that all other containers run fine and execute the steps properly like the google sdk alpine image

The parts that failing in our bitbucket-pipelines.yml

- step:
name: Install Dependencies
script:
- composer install
caches:
- composer
- vendor

- step:
name: Test
script:
- /vendor/bin/phpunit
caches:
- composer
- vendor 

This is our current test container setup

FROM ubuntu:20.04

WORKDIR /root

# Install PHP & NodeJS
RUN apt update && \
apt upgrade --yes --no-install-recommends &&\
apt install \
software-properties-common \
curl \
tzdata \
--no-install-recommends \
--yes && \
curl -fsSL https://deb.nodesource.com/setup_lts.x | bash - && \
add-apt-repository ppa:ondrej/php && \
apt install \
php8.0-bcmath \
php8.0-common \
php8.0-cli \
php8.0-curl \
php8.0-gd \
php8.0-imagick \
php8.0-intl \
php8.0-mbstring \
php8.0-mysql \
php8.0-opcache \
php8.0-imagick \
php8.0-readline \
php8.0-redis \
php8.0-soap \
php8.0-xml \
php8.0-zip \
nodejs \
git \
--no-install-recommends \
--yes && \
apt clean && \
rm -rf /var/lib/apt/lists/*

# Install PHP tools
RUN php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" && \
php composer-setup.php --install-dir=/usr/local/bin --filename=composer

USER nobody

ENV HOME /root


VOLUME ["/root"]
CMD ["bash"]

 

1 answer

1 accepted

1 vote
Answer accepted

Hi Tigo and welcome to the community!

I've built a Docker image based on the Dockerfile you posted here and I see the same issue. The issue gets resolved if I remove the following line from the Dockerfile:

USER nobody

So, this seems to be the culprit, I suspect because Pipelines by default runs as root.

Are you able to use the image if you remove that from the Dockerfile?

Kind regards,
Theodora

Thank you for your suggestion!

 

It was indeed the problem...

 

Thanks!

You are very welcome, I'm glad to have helped.

Please feel free to reach out if you ever need anything else!

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
TAGS
Community showcase
Published in Bitbucket

Git push size limits are coming to Bitbucket Cloud starting April 4th, 2022

Beginning on April 4th, we will be implementing push limits. This means that your push cannot be completed if it is over 3.5 GB. If you do attempt to complete a push that is over 3.5 GB, it will fail...

2,229 views 2 9
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you