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

Self-hosted runner, docker container stuck in foreground

colin_broderick
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
December 18, 2023

I am trying to set up pipelines and it's all working well except the docker component. I don't have much experience with docker, mostly because I can never quite get it to do what I want. I can run the container and it works, but I want it to live in the background in daemon mode. However it always sits in the foreground and I can't exit without killing it. This is true even with the -d option. The command suggested when setting up pipelines in the GUI is the following:

```

docker container run
    -it
    -v /tmp:/tmp
    -v /var/run/docker.sock:/var/run/docker.sock
    -v /var/lib/docker/containers:/var/lib/docker/containers:ro
    -e ACCOUNT_UUID={xxxxxxxxxxxxxxxx}
    -e RUNNER_UUID={xxxxxxxxxxxxxxxx}
    -e RUNTIME_PREREQUISITES_ENABLED=true
    -e OAUTH_CLIENT_ID=xxxxxxxxxxxxxxxxx
    -e OAUTH_CLIENT_SECRET=xxxxxxxxxxxxxxxxx
    -e WORKING_DIRECTORY=/tmp
    --name runner-xxxxxx-xxxxxx-xxxxxx-xxxxxx-xxxxxx
       docker-public.packages.atlassian.com/sox/atlassian/bitbucket-pipelines-runner:1

```

This sits in the foreground. If I remove `-it` (for interactive?) it still sits in the foreground but I can no longer interact with it at all, even to close it. If I add -d nothing changes.

Appreciate any help you can offer.

1 answer

0 votes
Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
December 19, 2023

Hi Colin,

If you start the container with the preconfigured command we provide, you can detach it with the keyboard shortcuts Ctrl+p and right after Ctrl+q.

If you want to attach it later on, first run the command

docker ps

In the output, look for the line where the IMAGE is

docker-public.packages.atlassian.com/sox/atlassian/bitbucket-pipelines-runner:1

and copy the CONTAINER ID for that image. Let's say that is 939b16b1c580.

If you then run the command

docker attach 939b16b1c580

you can view the container's output in your terminal.

The argument -d should also work when you start the container, but you need to use it along the other arguments like this:

docker container run
-itd
<the rest of the arguments>

Please feel free to let me know how it goes and if you have any questions.

Kind regards,
Theodora

colin_broderick
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
December 19, 2023

> you can detach it with the keyboard shortcuts Ctrl+p and right after Ctrl+q

Thanks Theodora, that solves the problem. Wasn't aware of those shortcuts. Still a docker novice.

Regards,

Colin

Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
December 20, 2023

You are very welcome Colin, please feel free to reach out if you ever need anything else!

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events