nitrictech / cli

Nitric CLI. Manage and run Nitric apps locally and deploy to any cloud.
https://nitric.io
Apache License 2.0
26 stars 10 forks source link

fix: ensure docker in docker can run properly via new env variable #770

Closed davemooreuws closed 3 months ago

davemooreuws commented 3 months ago

Fixes #769

Adds new env variable called NITRIC_DOCKER_HOST , this can be set to an IP like 172.17.0.4 on runners like GitLab and other Docker in Docker environments.

I have tested on:

codecov[bot] commented 3 months ago

Codecov Report

Attention: Patch coverage is 0% with 2 lines in your changes missing coverage. Please review.

Project coverage is 1.08%. Comparing base (1723d34) to head (1b4ad81). Report is 1 commits behind head on main.

Files Patch % Lines
pkg/project/service.go 0.00% 2 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #770 +/- ## ===================================== Coverage 1.08% 1.08% ===================================== Files 80 79 -1 Lines 8886 8853 -33 ===================================== Hits 96 96 + Misses 8780 8747 -33 Partials 10 10 ``` | [Flag](https://app.codecov.io/gh/nitrictech/cli/pull/770/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=nitrictech) | Coverage Δ | | |---|---|---| | [unittests](https://app.codecov.io/gh/nitrictech/cli/pull/770/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=nitrictech) | `1.08% <0.00%> (+<0.01%)` | :arrow_up: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=nitrictech#carryforward-flags-in-the-pull-request-comment) to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

tjholm commented 3 months ago

It looks like gitlab exposes a docker hostname locally.

DOCKER_HOST as you've mentioned appears to be a convention for configuring this in CI/CD.

When you tested setting DOCKER_HOST did you use the env variable in the CLI to set host.docker.internal to the same value?

Rather than searching the eth0 which may not apply in all cases we could look at allowing it to be configured? e.g. use DOCKER_HOST or something else like NITRIC_HOST?

Main concern is that a search for eth0 will not cover all cases or may change/break in ways we may not be able to control or predict.

davemooreuws commented 3 months ago

It looks like gitlab exposes a docker hostname locally.

DOCKER_HOST as you've mentioned appears to be a convention for configuring this in CI/CD.

When you tested setting DOCKER_HOST did you use the env variable in the CLI to set host.docker.internal to the same value?

Rather than searching the eth0 which may not apply in all cases we could look at allowing it to be configured? e.g. use DOCKER_HOST or something else like NITRIC_HOST?

Main concern is that a search for eth0 will not cover all cases or may change/break in ways we may not be able to control or predict.

Agreed, we want to avoid it being brittle. Will need to double check setting the same value as DOCKER_HOST. I think a nitric based env var will work more broadly (have a feeling the azure and GCP might need configuring as well), but let's try it tomorrow. We can keep the WSL fix in.

nitric-bot commented 3 months ago

:tada: This PR is included in version 1.50.4 :tada:

The release is available on GitHub release

Your semantic-release bot :package::rocket: