JetBrains / teamcity-docker-agent

TeamCity agent docker image sources
https://hub.docker.com/r/jetbrains/teamcity-agent/
Apache License 2.0
77 stars 64 forks source link

Docker-In-Docker daemon proxy settings #1

Closed jsm174 closed 6 years ago

jsm174 commented 7 years ago

Is it possible to set proxy settings for the docker-in-docker daemon when starting the agent?

For example when I run the agent:

docker run --rm -it -e SERVER_URL="<server>" -e AGENT_NAME="<agent>" -e GIT_SSL_NO_VERIFY=1 -v agent:/data/teamcity_agent/conf --privileged -e DOCKER_IN_DOCKER="start" jetbrains/teamcity-agent

I have to bash in:

docker exec -i -t <container id> /bin/bash

And then add the proxies to /etc/default/docker:

echo "export http_proxy=http://proxy:port" >> /etc/default/docker echo "export https_proxy=http://proxy:port" >> /etc/default/docker

And finally restart the service:

service docker restart

If I don't do this, when building images I get:

[03:25:58][Step 2/3] docker: Error response from daemon: Get https://registry-1.docker.io/v2/: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers).

VladRassokhin commented 6 years ago

There's no possibility to change docker settings as some property, recommended solution is to create new image with dockerfile like

FROM jetbrains/teamcity-agent
ENV DOCKER_IN_DOCKER=start
RUN echo "export http_proxy=http://proxy:port"  >> /etc/default/docker \
    echo "export https_proxy=http://proxy:port" >> /etc/default/docker