The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

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

Tigo Middelkoop
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
September 22, 2021

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

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

1 vote
Answer accepted
Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
September 24, 2021

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

Tigo Middelkoop
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
September 27, 2021

Thank you for your suggestion!

 

It was indeed the problem...

 

Thanks!

Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
September 27, 2021

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

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

DEPLOYMENT TYPE
CLOUD
TAGS
AUG Leaders

Atlassian Community Events