Rename DOCKER_HOST to REMOTE_DOCKER_HOST for configuring remote URL The connection to a remote Docker is performed through the DOCKER_HOST URL in config.xml. Previously the DOCKER_HOST was clashing with the local environment, making Docker thinking that also the server needed to be started remotely. Rename the variable to REMOTE_DOCKER_HOST to avoid clashes with the communication with the local Docker daemon. Also, the new REMOTE_DOCKER_HOST variable is stored into the Jenkins environment so that the configuration XSLT processor can replace it into the config.xml and allow Jenkins to start with the proper connectivity to the remote Docker server. Change-Id: Ibd40c2cb26148dd946f724cc5ad1c608dccecf11
diff --git a/jenkins-docker/server/Dockerfile b/jenkins-docker/server/Dockerfile index 37cdaea..6ee9bd5 100644 --- a/jenkins-docker/server/Dockerfile +++ b/jenkins-docker/server/Dockerfile
@@ -41,7 +41,7 @@ ENV OAUTH_SECRET secret ENV JENKINS_API_USER user ENV JENKINS_API_PASSWORD pass -ENV DOCKER_HOST unix:///var/run/docker.sock +ENV REMOTE_DOCKER_HOST unix:///var/run/docker.sock ENV BINTRAY_URL https://dl.bintray.com/lucamilanesio COPY edit-config.xslt $JENKINS_REF
diff --git a/jenkins-docker/server/Makefile b/jenkins-docker/server/Makefile index 6cdbce2..96d6572 100644 --- a/jenkins-docker/server/Makefile +++ b/jenkins-docker/server/Makefile
@@ -18,6 +18,7 @@ GERRIT_CI_PEM=./tls/gerrit-ci.pem UID=1000 GID=1000 +REMOTE_DOCKER_HOST=unix:///var/run/docker.sock # To bump plugin versions: # * Make required changes in required_plugins.txt and set PLUGIN_FILE=required_plugins.txt # * Run `make start`, check the plugins work using the console @@ -53,13 +54,14 @@ create_env: printf \ - "USE_SECURITY=%s\nOAUTH_ID=%s\nOAUTH_SECRET=%s\nJENKINS_API_USER=%s\nJENKINS_API_PASSWORD=%s\nDOCKER_GID=%s\n" \ + "USE_SECURITY=%s\nOAUTH_ID=%s\nOAUTH_SECRET=%s\nJENKINS_API_USER=%s\nJENKINS_API_PASSWORD=%s\nDOCKER_GID=%s\nREMOTE_DOCKER_HOST=%s\n" \ "${USE_SECURITY}" \ "${OAUTH_ID}" \ "${OAUTH_SECRET}" \ "${JENKINS_API_USER}" \ "${JENKINS_API_PASSWORD}" \ - "${DOCKER_GID}" > jenkins-container.env + "${DOCKER_GID}" \ + "${REMOTE_DOCKER_HOST}" > jenkins-container.env start_internal: build_internal create_env ${GERRIT_CI_PEM} -docker rm ${NAME_INTERNAL}
diff --git a/jenkins-docker/server/config.sh b/jenkins-docker/server/config.sh index 1c9657f..3f28d31 100755 --- a/jenkins-docker/server/config.sh +++ b/jenkins-docker/server/config.sh
@@ -15,7 +15,7 @@ xsltproc \ --stringparam use-security $USE_SECURITY \ - --stringparam docker-url $DOCKER_HOST \ + --stringparam docker-url $REMOTE_DOCKER_HOST \ --stringparam oauth-client-id $OAUTH_ID \ --stringparam oauth-client-secret $OAUTH_SECRET \ $JENKINS_REF/edit-config.xslt $CONFIG > /tmp/config.xml.new