Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
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

Self hosted runner: Execute command from Bitbucket runner to another container

Edited

Hi to all,

on my personal host I have a 3 container:

  •  .Bitbucker runner
  • . debian with dpkg-buildpackage script
  • . apache web server

When I login inside Bitbucket runner container, from inside  I can do it  "docker ps ",    the output is that:

output.PNG

from Bitbucker runner container I can do  docker ps;  "docker exec -it container_name foo_bar" and/or "docker run"

but

When I run my pipeline:



image
: atlassian/default-image:3 options: docker: true pipelines: default: - step: name: 'execute command from external container' script: - docker exec -itu infallible_vaughan any_command_you_want

 

I retrive this error:

Error: No such container:

 

someone can help me to use the container that are running on my server from Bitbucket pipeline?

 

1 answer

0 votes

Hi @nioanto,

In order to provide isolation and reproducibility, a runner doesn’t provide access directly to the host file system, so it is not possible to access any Docker containers that are running on the host machine during a Pipelines (runner) build.

You could run a docker container during the build with a docker run command in your yml file and it should then be possible to execute docker commands in that container with docker exec, but without the -it options, as they aren't supported in Pipelines.

Also, just a heads up, you need to add a runs-on parameter to a step in the bitbucket.pipelines.yml file with at least the self-hosted label, in order for the build to run on your runner:

I'm not sure if you have that already in the yml file of your repo and removed it when you copied and pasted the contents of the yml file here, I just mention it in case it's missing.

Kind regards,
Theodora

Suggest an answer

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

📣 Calling Bitbucket Data Center customers to participate in research

Hi everyone, Are you Bitbucket DC customer? If so, we'd love to talk to you! Our team wants to dive deep to understand your long-term plans regarding Bitbucket DC and Atlassian Cloud. Do you plan...

218 views 2 5
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