It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

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

lamiren Aug 19, 2017

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.

2 answers

0 votes
Edwin Kyalangalilwa Community Leader Aug 19, 2017 • edited

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

 

lamiren Aug 25, 2017

Thanks for answering! it works!!

teamg@synapseindia.com Oct 27, 2017 • edited

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

 

Travis Taylor Oct 30, 2017

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

stones_junior Dec 05, 2017

This is correct @Edwin Kyalangalilwa ?

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 Jul 20, 2018

same issue here

Edwin Kyalangalilwa Community Leader Jul 23, 2018

@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?

0 votes
kumar rahul Oct 08, 2018
No passwd entry for user 'groupadd'
Edwin Kyalangalilwa Community Leader Oct 08, 2018 • edited

@kumar rahul,

The command should be

sudo groupadd docker

 

It's trying to switch user to groupadd.

kumar rahul Oct 08, 2018 • edited
sudo groupadd docker
bash: sudo: command not found
Edwin Kyalangalilwa Community Leader Oct 08, 2018

Are you using ubuntu? If so you can install using

apt-get install sudo

or try running without sudo.

groupadd docker  
kumar rahul Oct 08, 2018
usermod -aG docker $user 
usermod -aG docker $user
Usage: usermod [options] LOGIN
kumar rahul Oct 08, 2018


usermod -aG docker
usermod -aG docker
Usage: usermod [options] LOGIN

 

Please help

Suggest an answer

Log in or Sign up to answer
This widget could not be displayed.
This widget could not be displayed.
Community showcase
Published in Bitbucket Pipelines

Building a Bitbucket Pipe as a casual coder

...ipe.sh :  #!/bin/bash source "$(dirname "$0")/common.sh" enable_debug extra_args="" if [[ "${DEBUG}" == "true" ]]; then extra_args="--verbose" fi # mandatory variables R...

3,236 views 1 22
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