General usage without requiring PHP installed locally
fabriciojs opened this issue · 6 comments
This bas been partially accomplished with #30 - already making DinD proxy. To 100% local DinD usage need to write some shell utility that passes in the proper DOCKER_HOST
environment variable as well as mounting the socket volume properly in the running container.
For a 100% only docker execution, we can:
For Linux:
- Mount the socket onto the container (default under Linux)
For Mac and Linux:
- Use the host network, then setting
DOCKER_HOST
togateway.docker.internal:3128
(getting this fromdocker system info
) orlocalhost
(for Linux TCP listener, which should be unusual).
This is working on mac:
#! /bin/bash
# if docker-dind ! started
# docker run \
# -v $(pwd):/app \
# -v docker-dind:/var/lib/docker \
# --rm --privileged -d \
# --name docker-dind \
# -p 80:80 \
# docker:dind
docker run \
--link docker-dind:docker \
-v $(pwd):/app \
--rm --init -it fireworkweb/fwd \
fwd "$@"
# if $@ === down
# docker stop docker-dind
@carlbastos please take a look at this - would be awesome if we had a one-liner bash that will require only bash to run and install a bash in the system to execute fwd without any requirement other than docker
(and bash
).
New versions of Docker require TLS by default, which will usually make the default non-TLS port 2375 to not get up.
So we need to set DOCKER_TLS_CERTDIR
for DinD so the non-TLS port will be up:
docker run -e DOCKER_TLS_CERTDIR="" --rm -v $(pwd):/app -w /app -v docker-dind:/var/lib/docker --privileged -d --name docker-dind -p 80:80 docker:dind
then we can normally run fwd
:
docker run --link docker-dind:docker -v $(pwd):/app --rm --init -it fireworkweb/fwd fwd -V
There is a bunch of open questions about this experimental approach:
- Volumes and permissions between host > dind > fwd container > service containers.
- Cache for DinD images
- Output ports - binding ports from the service containers will bind to the dind container that need then to be bound to the host (or not?)
The new kool solution doesn't have this issue since it is already a self-contained binary.