Failed to Build Pipeline: Do not run Composer as root/super user!

Hello 

I encountered the following failed message hen building pipeling:

+ composer installDo not run Composer as root/super user!

my  bitbucket-pipelines.yml is made from doc as following:

image: php:7.1.1
pipelines:
default:
- step:
script:
- apt-get update && apt-get install -y unzip
- curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
- composer require phpunit/phpunit
- vendor/bin/phpunit

 

 I'm very new to bitbucket and docker. Could anyone give me an instruction to fix this? Thank you very much in advance.

1 answer

This widget could not be displayed.

Run it as a user other than root. You can add a user to be able to control Docker using

usermod -a -G docker <user>

Clear cache of the .composer by removing the folder and change owner of

/usr/local/bin/composer

 

Thanks for answering! it works!!

i am also facing similar problem can you please explain in detail the steps you followed. i don't know how to run above command.

My bitbucket-pipelines.yml file is having this code

# This is a sample build configuration for PHP.
# Check our guides at https://confluence.atlassian.com/x/e8YWN for more examples.
# Only use spaces to indent your .yml configuration.
# -----
# You can specify a custom docker image from Docker Hub as your build environment.
image: php:7.1.1

pipelines:
  default:
    - step:
        caches:
          - composer
        script:
          - apt-get update && apt-get install -y unzip
          - curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
          - composer install
          - vendor/bin/phpunit

 

Would love to see the steps you followed in detail as well.

This is correct @Edwin Kyalangalilwa [Mumo Systems] ?

pipelines:
default:
- step:
caches:
- composer
script:
- su groupadd docker
- su usermod -aG docker $user
- apt-get update && apt-get install -y unzip
- curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
- su chown user -hR /usr/local/bin/composer
- su user composer install
- vendor/bin/phpunit

 I try but is not working :(

@Jörn Bottenhorn Try adding - and make sure to use sudo when running these commands where necessary.

sudo chmod 755 /usr/local/bin/composer

It'll help to see specific errors. 

@stones_junior - what error are you getting?

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Aug 21, 2018 in Bitbucket

Branch Management with Bitbucket

As a project manager, I have discovered that different developers want to bring their previous branching method with them when they join the team. Some developers are used to performing individual wo...

1,310 views 8 11
Read article

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you