Skip to content

Commit 1d5c175

Browse files
committed
Add initial README
1 parent a59db7f commit 1d5c175

File tree

1 file changed

+40
-1
lines changed

1 file changed

+40
-1
lines changed

README.md

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,40 @@
1-
# docker-on-docker-shim
1+
# docker-on-docker-shim
2+
3+
This is a shim that remaps volume mounts when running docker on docker. Aimed to fix <https://stackoverflow.com/questions/31381322> with no hassle.
4+
5+
## Compare it yourself
6+
7+
Using the [`fixdockergid`](https://github.com/felipecrs/fixdockergid) image to test, where the `/usr/local/bin/fixdockergid` is only available within the container:
8+
9+
```bash
10+
# This does not work
11+
docker run --rm -u "$(id -u):$(id -g)" -v /var/run/docker.sock:/var/run/docker.sock felipecrs/fixdockergid docker run --rm -v /usr/local/bin/fixdockergid:/fixdockergid ubuntu test -f /fixdockergid
12+
13+
# A non-zero exit code indicates that it did not work
14+
echo $?
15+
16+
# This does
17+
docker run --rm -u "$(id -u):$(id -g)" -v /var/run/docker.sock:/var/run/docker.sock ghcr.io/felipecrs/dond-shim docker run --rm -v /usr/local/bin/fixdockergid:/fixdockergid ubuntu test -f /fixdockergid
18+
19+
# A zero exit code indicates that it worked
20+
echo $?
21+
```
22+
23+
## Installation
24+
25+
Considering your container already has the `docker` CLI installed at `/usr/bin/docker`:
26+
27+
```dockerfile
28+
FROM my-image-with-docker-cli
29+
30+
USER root
31+
32+
ARG DOCKER_PATH="/usr/bin/docker"
33+
ARG DOND_SHIM_REVISION="main"
34+
RUN mv -f "${DOCKER_PATH}" "${DOCKER_PATH}.orig" && \
35+
curl -fsSL "https://github.com/felipecrs/docker-on-docker-shim/raw/${DOND_SHIM_REVISION}/docker" \
36+
--output "${DOCKER_PATH}" && \
37+
chmod +x "${DOCKER_PATH}"
38+
39+
USER non-root-user
40+
```

0 commit comments

Comments
 (0)