Is it possible NO_PROXY be exported to docker service in self-hosted pipelines runner
Asked by Aaron.Luo:

Hi team,

We are running self-hosted pipelines runners. Recently it is good to see that HTTP_PROXY and HTTPS_PROXY get exported to docker service in self-hosted pipelines runner, which gives us opportunity of simplifying pipelines.yml by not adding HTTP(S)_PROXY for the docker service in pipelines.yml.

In my bitbucket pipeline runner, we have HTTP(S)_PROXY, NO_PROXY, http(s)_proxy, no_proxy environments; and "httpProxy", "httpsProxy" and "noProxy" defined in \~/.docker/config.json; and "-Dhttps.proxyHost=\<myproxy\>\< -Dhttps.proxyPort=\<port\> -Dhttp.proxyHost=\<myproxy\> -Dhttp.proxyPort=\<port\> -Dhttp.nonProxyHosts=\<noproxyhosts\>" in JAVA_TOOL_OPTIONS env variable. I guess docker service get HTTP(S)_PROXY from one of these settings.

Unfortunately NO_PROXY isn't exported for some reason, which causes issues for some registry (such as gcr.io) that should not go through proxy.

I was wondering if it's possible to also export NO_PROXY env variable to docker service.

The docker service used to be defined as

```
definitions:
  services:
    docker:
      image:
        - name: mydocker:dind
      environment:
        HTTP_PROXY: $HTTP_PROXY
        HTTPS_PROXY: $HTTP_PROXY
        NO_PROXY: $NO_PROXY
```

Now it can be defined as

```
definitions:
  services:
    docker:
      image:
        - name: mydocker:dind
      environment:
        NO_PROXY: $NO_PROXY
```

Once NO_PROXY is able to be exported to docker service, it can be defined as

```
definitions:
  services:
    docker:
      image:
        - name: mydocker:dind
```

I also wonder if we can define the default docker service image in an environment variable of bitbucket pipelines runner just as CLONE_IMAGE, AUTH_PROXY_IMAGE and PAUSE_IMAGE. Maybe more env variables for default resources that docker service consumes. If this is possible, we don't need to define docker service in the pipelines.yml at all. Our developers would be very happy that they don't have to care about these details so they can focus on their own work.

Kind regards,

Aaron


Answers:
author: Theodora Boudale
body: Hi Aaron,

Thank you for the feedback.

I went ahead and created a feature request for adding support for the NO_PROXY variable as well:

* <https://jira.atlassian.com/browse/BCLOUD-22509>

I would suggest adding your vote to the feature request (by selecting the **Vote for this issue** link) as the number of votes helps the development team and product managers better understand the demand for new features. You are more than welcome to leave any feedback, and you can also add yourself as a watcher (by selecting the **Start watching this issue** link) if you'd like to get notified via email on updates.

Implementation of new features is done as per our policy [here](https://confluence.atlassian.com/support/implementation-of-new-features-policy-201294576.html) and any updates will be posted in the feature request.

Regarding your second request, defining the default docker service image in an environment variable, please allow me to check with the development team and I will get back to you.

Kind regards,  
Theodora

comments: author: Theodora Boudale
body: Hi Aaron,

I discussed with the development team about your second request. The reason we offer the variables PAUSE_IMAGE, AUTH_PROXY_IMAGE and CLONE_IMAGE, is that they cannot be configured in the bitbucket-pipelines.yml file. However, services are under a user's control and they can be configured in the bitbucket-pipelines.yml file, so I'm afraid that there is no plan to implement the configuration of the Docker service with environment variables at the moment.

I went ahead and created a feature request about this in our issue tracker so we can gather interest, and if there is more interest in this feature, our development team may reconsider. Please make sure to add your vote and comment to give it more weight and further express your interest:

* <https://jira.atlassian.com/browse/BCLOUD-22512>

Kind regards,  
Theodora


Tags: bitbucket-cloud

bitbucket-pipelines

bitbucket-runners

cloud

server