Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Deleted user
0 / 0 points
Next:
badges earned

Your Points Tracker
Challenges
Leaderboard
  • Global
  • Feed

Badge for your thoughts?

You're enrolled in our new beta rewards program. Join our group to get the inside scoop and share your feedback.

Join group
Recognition
Give the gift of kudos
You have 0 kudos available to give
Who do you want to recognize?
Why do you want to recognize them?
Kudos
Great job appreciating your peers!
Check back soon to give more kudos.

Past Kudos Given
No kudos given
You haven't given any kudos yet. Share the love above and you'll see it here.

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

Going inside docker container in build step

I am trying to use bitbucket pipeline as follows

 

image: ubuntu:16.04

pipelines:
default:
- step:
script:
- apt-get update
- apt-get install -y curl
- curl -L https://github.com/docker/compose/releases/download/1.18.0/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
- chmod +x /usr/local/bin/docker-compose
- docker network create docker_default
- docker-compose -f docker/production.yml up -d --build
- docker exec -i -d frontend_php bash
- cd /var/www
- composer install
services:
- docker

 

What i wanted to do is do docker-exec  and then do rest of my steps including composer install and unit testing inside the container.

 

Somehow I receive the following error.

 

bash: cd: /var/www: No such file or directory

 

I am not sure if this is trying to run the cd command inside my frontend_php container or the build container.

 

I have mounted the code to /var/www in my production.yml file as follows 

 

version: '2'
services:
frontend_php:
container_name: frontend_php
build: ./php-fpm
working_dir: /var/www
networks:
- docker_default
volumes:
- ../:/var/www
frontend_nginx:
container_name: frontend_nginx
build: ./nginx
working_dir: /var/www
networks:
- docker_default
volumes_from:
- frontend_php
ports:
- 8080:80

networks:
docker_default:
external: true

2 answers

If you want my advice install any php library using composer and then run `docker-compose up` as any command you run after `docker exec -i -d frontend_php bash` is executed within pipeline host  not within your docker image.

you can check https://hub.docker.com/r/zaherg/php-7.2-xdebug-alpine/ which will provide you with a ready to run php image that has composer already installed, so your pipeline will be something like:

 

image: zaherg/php-7.2-xdebug-alpine:latest

pipelines:
default:
- step:
script:
- composer install

- curl -L https://github.com/docker/compose/releases/download/1.18.0/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
- chmod +x /usr/local/bin/docker-compose
- docker network create docker_default
- docker-compose -f docker/production.yml up -d --build
services:
- docker

did you ever figure this out. ? 

Suggest an answer

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

New improvements to user management in Bitbucket Cloud 👥

Hey Community! We’re willing to wager that quite a few of you not only use Bitbucket, but administer it too. Our team is excited to share that we’ll be releasing improvements throughout this month of...

256 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