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.
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
> 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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You are very welcome Colin, please feel free to reach out if you ever need anything else!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.