Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

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,558,747
Community Members
 
Community Events
184
Community Groups

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.

3 answers

No passwd entry for user 'groupadd'
edwin
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
Oct 08, 2018 • edited

@kumar_rahul2025,

The command should be

sudo groupadd docker

 

It's trying to switch user to groupadd.

sudo groupadd docker
bash: sudo: command not found
edwin
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
Oct 08, 2018

Are you using ubuntu? If so you can install using

apt-get install sudo

or try running without sudo.

groupadd docker  
usermod -aG docker $user 
usermod -aG docker $user
Usage: usermod [options] LOGIN


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

 

Please help

The easiest way for me was add "COMPOSER_ALLOW_SUPERUSER=1" to allow composer run as super user in the bitbucket pipelines:

- export COMPOSER_ALLOW_SUPERUSER=1

- curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
- composer -V
0 votes
edwin
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
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

 

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 ?

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 :(

same issue here

edwin
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
Jul 23, 2018

@ffmit 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
TAGS
AUG Leaders

Atlassian Community Events