Skip to content

Commit 578f497

Browse files
committed
Add "cap_drop" with "NET_RAW" to Docker services to prevent Polaris issue.
1 parent 8214ed4 commit 578f497

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

test-app/docker-compose.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@ services:
1515
ports:
1616
- "9092:9092"
1717
- "9101:9101"
18+
19+
# The NET_RAW capability allows a process to create raw sockets. Polaris does not like that.
20+
# This setting removes the NET_RAW capability from the container.
21+
cap_drop:
22+
- NET_RAW
1823
environment:
1924
KAFKA_NODE_ID: 1
2025
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: 'CONTROLLER:PLAINTEXT,PLAINTEXT:PLAINTEXT,PLAINTEXT_HOST:PLAINTEXT'
@@ -43,6 +48,8 @@ services:
4348
- broker
4449
ports:
4550
- "8081:8081"
51+
cap_drop:
52+
- NET_RAW
4653
environment:
4754
SCHEMA_REGISTRY_HOST_NAME: schema-registry
4855
SCHEMA_REGISTRY_KAFKASTORE_BOOTSTRAP_SERVERS: 'broker:29092'
@@ -57,6 +64,8 @@ services:
5764
- schema-registry
5865
ports:
5966
- "8083:8083"
67+
cap_drop:
68+
- NET_RAW
6069
environment:
6170
CONNECT_BOOTSTRAP_SERVERS: 'broker:29092'
6271
CONNECT_REST_ADVERTISED_HOST_NAME: connect
@@ -91,6 +100,8 @@ services:
91100
- ksqldb-server
92101
ports:
93102
- "9021:9021"
103+
cap_drop:
104+
- NET_RAW
94105
environment:
95106
CONTROL_CENTER_BOOTSTRAP_SERVERS: 'broker:29092'
96107
CONTROL_CENTER_CONNECT_CONNECT-DEFAULT_CLUSTER: 'connect:8083'
@@ -113,6 +124,8 @@ services:
113124
- connect
114125
ports:
115126
- "8088:8088"
127+
cap_drop:
128+
- NET_RAW
116129
environment:
117130
KSQL_CONFIG_DIR: "/etc/ksql"
118131
KSQL_BOOTSTRAP_SERVERS: "broker:29092"
@@ -136,6 +149,8 @@ services:
136149
- ksqldb-server
137150
entrypoint: /bin/sh
138151
tty: true
152+
cap_drop:
153+
- NET_RAW
139154

140155
ksql-datagen:
141156
image: confluentinc/ksqldb-examples:7.6.1
@@ -153,6 +168,8 @@ services:
153168
echo Waiting a few seconds for topic creation to finish... && \
154169
sleep 11 && \
155170
tail -f /dev/null'"
171+
cap_drop:
172+
- NET_RAW
156173
environment:
157174
KSQL_CONFIG_DIR: "/etc/ksql"
158175
STREAMS_BOOTSTRAP_SERVERS: broker:29092
@@ -168,6 +185,8 @@ services:
168185
- 8082:8082
169186
hostname: rest-proxy
170187
container_name: rest-proxy
188+
cap_drop:
189+
- NET_RAW
171190
environment:
172191
KAFKA_REST_HOST_NAME: rest-proxy
173192
KAFKA_REST_BOOTSTRAP_SERVERS: 'broker:29092'
@@ -188,6 +207,8 @@ services:
188207
- "8000-8002:8000-8002"
189208
- "8010-8013:8010-8013"
190209
- "8018-8019:8018-8019"
210+
cap_drop:
211+
- NET_RAW
191212

192213
# Copied from https://docs.sonarsource.com/sonarqube/latest/setup-and-upgrade/install-the-server/#example-docker-compose-configuration .
193214
sonarqube:
@@ -204,6 +225,8 @@ services:
204225
- sonarqube_logs:/opt/sonarqube/logs
205226
ports:
206227
- "9000:9000"
228+
cap_drop:
229+
- NET_RAW
207230

208231
postgres:
209232
image: postgres:15-alpine
@@ -213,6 +236,8 @@ services:
213236
volumes:
214237
- postgresql:/var/lib/postgresql
215238
- postgresql_data:/var/lib/postgresql/data
239+
cap_drop:
240+
- NET_RAW
216241

217242
volumes:
218243
sonarqube_data:

0 commit comments

Comments
 (0)