Skip to content

Commit c68aab6

Browse files
committed
Run container in privileged mode to support docker-in-docker and docker-out-of-docker.
1 parent ebb760e commit c68aab6

File tree

4 files changed

+12
-9
lines changed

4 files changed

+12
-9
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ To build the jar, run `./gradlew clean build`
1515
## License
1616

1717
```plain
18-
Copyright 2017 ThoughtWorks, Inc.
18+
Copyright 2018 ThoughtWorks, Inc.
1919
2020
Licensed under the Apache License, Version 2.0 (the "License");
2121
you may not use this file except in compliance with the License.

build.gradle

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2017 ThoughtWorks, Inc.
2+
* Copyright 2018 ThoughtWorks, Inc.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -54,7 +54,7 @@ dependencies {
5454
compile group: 'com.google.guava', name: 'guava', version: '19.0'
5555
compile group: 'org.apache.commons', name: 'commons-lang3', version: '3.4'
5656
compile group: 'joda-time', name: 'joda-time', version: '2.9.4'
57-
compile group: 'io.fabric8', name: 'kubernetes-client', version: '3.1.6'
57+
compile group: 'io.fabric8', name: 'kubernetes-client', version: '3.1.8'
5858
compile group: 'com.github.spullara.mustache.java', name: 'compiler', version: '0.9.5'
5959
compile group: 'org.freemarker', name: 'freemarker', version: '2.3.23'
6060

@@ -81,9 +81,9 @@ jar {
8181
from(configurations.compile) {
8282
into "lib/"
8383
}
84-
from(sourceSets.main.java) {
85-
into "/"
86-
}
84+
// from(sourceSets.main.java) {
85+
// into "/"
86+
// }
8787
}
8888

8989
tasks.withType(Jar) { jarTask ->

src/main/java/cd/go/contrib/elasticagent/KubernetesInstanceFactory.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2017 ThoughtWorks, Inc.
2+
* Copyright 2018 ThoughtWorks, Inc.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -57,6 +57,7 @@ private KubernetesInstance create(CreateAgentRequest request, PluginSettings set
5757
container.setName(containerName);
5858
container.setImage(image(request.properties()));
5959
container.setImagePullPolicy("IfNotPresent");
60+
container.setSecurityContext(new SecurityContextBuilder().withPrivileged(true).build());
6061

6162
container.setResources(getPodResources(request));
6263

src/main/resources/profile.template.html

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
~ Copyright 2017 ThoughtWorks, Inc.
2+
~ Copyright 2018 ThoughtWorks, Inc.
33
~
44
~ Licensed under the Apache License, Version 2.0 (the "License");
55
~ you may not use this file except in compliance with the License.
@@ -200,7 +200,9 @@
200200
spec:
201201
containers:
202202
- name: gocd-agent-container-{{ CONTAINER_POSTFIX }}
203-
image: {{ GOCD_AGENT_IMAGE }}:{{ LATEST_VERSION }}')">
203+
image: {{ GOCD_AGENT_IMAGE }}:{{ LATEST_VERSION }}
204+
securityContext:
205+
privileged: true')">
204206
</textarea>
205207
<span class="form_error form-error" ng-class="{'is-visible': GOINPUTNAME[PodConfiguration].$error.server}"
206208
ng-show="GOINPUTNAME[PodConfiguration].$error.server">{{GOINPUTNAME[PodConfiguration].$error.server}}</span>

0 commit comments

Comments
 (0)