How to run Lando in Pipelines

Gabriel Connolly August 11, 2021

I am trying to use Lando in my Bitbucket Pipelines to run my automated tests, but I am unable to get Lando to successfully start.  The problem I'm wrestling with is that as a `root` user I have access to the Docker Daemon, but when I switch to the `pipelines` user to try and start Lando, I am presented with:
```

Unhandled rejection Error: Could not automatically start the Docker Daemon. Please manually start it to continue.

```

The reason I am trying to run Lando as the `pipelines` user is Lando is specifically designed NOT to run as `root`: https://github.com/lando/lando/issues/545

I have tried adding the `pipelines` user to the `docker` user group per both the Docker and Lando documentation, but that does not seem to give me enough access to the Docker Daemon to the point where Lando will successfully start.

https://docs.docker.com/engine/install/linux-postinstall/
* https://docs.lando.dev/basics/installation.html#linux

 

My `bitbucket-pipelines.yml` file:

```

image:
name: libertyconcepts/bitbucket-pipelines-lando:1.0
run-as-user: 1000

definitions:
services:
docker:
memory: 3072

pipelines:
branches:
bitbucket-pipelines:
- step:
name: 'Deployment test on pipelines branch'
script:
- whoami
- groups pipelines
- docker info
- docker version
- lando version
services:
- docker

 Has anyone been able to successfully implement Lando in Pipelines, and if so, what am I missing?

 

 

1 answer

0 votes
Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
August 20, 2021

Hi @Gabriel Connolly ,

I've done some investigation on this issue, using a bitbucket-pipelines.yml file similar to yours that also tries to start a Lando app. I've been able to reproduce this issue in Pipelines, and a colleague of mine has also reproduced this issue when debugging it locally with Docker.

If we try to run, for testing purposes, a 'docker run' command in the build (the same build that is running as 'pipelines' user), the command is successful. This indicates that the build can connect to the docker(daemon) service when running as 'pipelines' user, and the issue doesn't seem to be related to the permissions of this user.

We also added flags for verbose output in both 'lando init' and 'lando start' commands. The verbose output of 'lando init' is showing that this command can detect the docker engine (the following is part of the output of 'lando init' with '-vvv' flag):

lando 03:33:03 VERBOSE ==> docker-engine exists: true 
lando 03:33:03 VERBOSE ==> docker-compose exists: true

However, based on the output of the 'lando start' command that you also posted here

Unhandled rejection Error: Could not automatically start the Docker Daemon. Please manually start it to continue.

it looks that 'lando start' is trying to start its own docker daemon instead of connecting to the existing docker (daemon) service.

It looks that the issue here has to do with the 'lando start' command. Our suggestion would be to reach out to Lando support team to investigate further why 'lando start' is trying to start its own docker daemon instead of connecting to the existing docker (daemon) service. A little background that you can share with Lando support team is that Pipelines set up Docker daemon as a separate container and then attach the port and socket to the main build container, which allows docker client to connect to docker daemon.

If you need any further info from us, please feel free to let me know.

Kind regards,
Theodora

Gabriel Connolly August 23, 2021

Thanks for the reply, @Theodora Boudale !  I'll see if I can work wit the Lando team/community to continue to troubleshoot this, and then bring my findings back here.

Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
August 24, 2021

You're very welcome Gabriel! Please feel free to post your findings here and also let me know if you need any further info.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
TAGS
AUG Leaders

Atlassian Community Events