Skip to content

Commit ee797a7

Browse files
committed
Add the Docker-in-Docker daemon #1938
Signed-off-by: Chin Yeung Li <tli@nexb.com>
1 parent d3ea0f7 commit ee797a7

2 files changed

Lines changed: 18 additions & 0 deletions

File tree

Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ RUN apt-get update \
145145
libguestfs-tools \
146146
linux-image-amd64 \
147147
openjdk-17-jre-headless \
148+
docker.io \
148149
&& apt-get clean \
149150
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
150151

docker-compose.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,25 @@ services:
3131
timeout: 5s
3232
retries: 5
3333

34+
# Add the Docker-in-Docker daemon
35+
dind:
36+
image: docker.io/library/docker:dind
37+
privileged: true
38+
environment:
39+
- DOCKER_TLS_CERTDIR=
40+
volumes:
41+
- dind_data:/var/lib/docker
42+
- workspace:/var/scancodeio/workspace/
43+
3444
web:
3545
build: .
3646
command: sh -c "
3747
./manage.py migrate &&
3848
./manage.py collectstatic --no-input --verbosity 0 --clear &&
3949
gunicorn scancodeio.wsgi:application --bind :8000 --timeout 600 \
4050
--workers ${GUNICORN_WORKERS:-8} --worker-tmp-dir /dev/shm"
51+
environment:
52+
- DOCKER_HOST=tcp://dind:2375 # Point to the DinD container
4153
env_file:
4254
- docker.env
4355
expose:
@@ -61,6 +73,8 @@ services:
6173
./manage.py rqworker --worker-class scancodeio.worker.ScanCodeIOWorker
6274
--queue-class scancodeio.worker.ScanCodeIOQueue
6375
--verbosity 1"
76+
environment:
77+
- DOCKER_HOST=tcp://dind:2375 # Point to the DinD container
6478
env_file:
6579
- docker.env
6680
volumes:
@@ -75,6 +89,8 @@ services:
7589
condition: service_healthy
7690
web:
7791
condition: service_started
92+
dind:
93+
condition: service_started
7894

7995
nginx:
8096
image: docker.io/library/nginx:1.31.4-alpine
@@ -104,3 +120,4 @@ volumes:
104120
static:
105121
workspace:
106122
webroot:
123+
dind_data:

0 commit comments

Comments
 (0)