Spaces:
Build error
Build error
Update Dockerfile
Browse files- Dockerfile +31 -1
Dockerfile
CHANGED
@@ -1,3 +1,33 @@
|
|
|
|
1 |
FROM docker:dind-rootless
|
2 |
|
3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Use the rootless Docker-in-Docker base image
|
2 |
FROM docker:dind-rootless
|
3 |
|
4 |
+
# Set the working directory inside the container
|
5 |
+
WORKDIR /app
|
6 |
+
|
7 |
+
# Copy the Nginx app's index.html and its Dockerfile (now named exdocker) into this container
|
8 |
+
COPY index.html ./
|
9 |
+
COPY exdocker ./
|
10 |
+
|
11 |
+
# Install curl to test the inner Nginx server
|
12 |
+
RUN apk add --no-cache curl
|
13 |
+
|
14 |
+
# Expose a port from this DinD container.
|
15 |
+
# We'll map the inner Nginx container's port 80 to this port (e.g., 8080)
|
16 |
+
# within the DinD container. Then, we can map this 8080 to the host.
|
17 |
+
EXPOSE 8080
|
18 |
+
|
19 |
+
# Define the entrypoint to start the rootless Docker daemon
|
20 |
+
ENTRYPOINT ["/usr/local/bin/dockerd-rootless.sh"]
|
21 |
+
|
22 |
+
# Define the command to execute once the daemon is up:
|
23 |
+
# 1. Wait for the Docker daemon to be ready (sleep 5 seconds).
|
24 |
+
# 2. Build the Nginx image using the copied Dockerfile (exdocker).
|
25 |
+
# 3. Run the Nginx container in detached mode, mapping its port 80
|
26 |
+
# to port 8080 *inside this DinD container*.
|
27 |
+
# 4. Keep this DinD container running indefinitely.
|
28 |
+
CMD ["sh", "-c", "sleep 5 && \
|
29 |
+
docker build -f exdocker -t my-nginx-app . && \
|
30 |
+
docker run -d -p 8080:80 --name my-inner-nginx my-nginx-app && \
|
31 |
+
echo 'Inner Nginx container started. Testing accessibility...' && \
|
32 |
+
curl http://localhost:8080 && \
|
33 |
+
sleep infinity"]
|