Skip to content
Snippets Groups Projects
Commit 87b27536 authored by jurgenhaas's avatar jurgenhaas
Browse files

#25 Wait for the socat container before starting l3d and update readme

parent 8051d1e1
No related branches found
Tags 1.9.0-beta3
No related merge requests found
......@@ -6,7 +6,7 @@ Provides fully configured Docker images for local Drupal development where your
Nothing else than docker being installed on your host. You don't need any other tool - none!
## Quick start
## Quick start Linux
You can install the tool with the following command:
......@@ -14,9 +14,24 @@ You can install the tool with the following command:
docker run -v /usr/local/bin:/setup --rm registry.lakedrops.com/docker/l3d/setup:latest
```
This will install the script `l3d` into the given directory `/usr/local/bin` from where it is executable everywhere on your host (assuming this path being in your search path). If you want that script to be installed elsewhere then provide that alternative path in the install command above. Also, instead of `latest` you can also start with any othe specific version number of this tool. You can find all available version string in the [tag list](https://gitlab.lakedrops.com/docker/l3d/tags) of this project.
This will install the script `l3d` into the given directory `/usr/local/bin` from where it is executable everywhere on your host (assuming this path being in your search path). If you want that script to be installed elsewhere then provide that alternative path in the install command above. Instead of `latest` you can also start with any other specific version number of this tool. You can find all available version strings in the [tag list](https://gitlab.lakedrops.com/docker/l3d/tags) of this project.
NOTE: depending on your system setup it may well be impossible for Docker to mount the example directory `/usr/local/bin` from above. We've seen this happening especially on MacOS. In such cases, please use a different directory and make sure that it's part of the PATH environment variable so that it remains convenient to execute that script from everywhere.
## Quick start MacOS
Here we have to circumwent some limitations that come with Docker for Mac:
1. Docker for Mac is not able to mount certain directories and one of those is anything underneath `/usr`. Therefore you have to use a different directory where the L3D script and some additional files get stored.
2. Docker for Mac does not properly mount sockets such that SSH agent can not be used inside of Docker containers the same way this is being done on Linux platforms. There are many workarounds available and we have integrated the approach from [mariusgrigaitis](https://github.com/mariusgrigaitis/docker-mac-ssh-auth-sock) into this project.
This requires [socat](https://linux.die.net/man/1/socat). You can install that with `sudo brew install socat` or `sudo port install socat` or any other method that is applicable to you specific Mac. After installation make sure that `socat` can be found in your search path. If it got installed in a directory that isn't in the path, you can create a symbolic link to it into `/usr/local/bin`.
Then use the following command to install L3D (replace `myname` with your correct username:
```bash
docker run -v /User/myname/bin:/setup --rm registry.lakedrops.com/docker/l3d/setup:latest
```
Then make sure that the directory `/User/myname/bin` is included in the PATH environment variable or create a symbolic link in `/usr/local/bin`. If you work with a symbolic link, MacOS also requires [coreutils](https://de.wikipedia.org/wiki/GNU_Core_Utilities) which can be installed with `sudo brew install coreutils` or `sudo port install coreutils`.
## Usage
......
......@@ -76,3 +76,12 @@ echo "Starting socket proxy."
# This is not really reliable because forwarding input/output over stdin/stdout does not allow for multiple communications
# at the same time. It fails when doing multiple connections to $SSH_AUTH_SOCK at the same time.
exec socat "EXEC:\"docker run -i --rm --name l3d_socat -v $(dirname $SSH_AUTH_SOCK):$(dirname $SSH_AUTH_SOCK) alpine/socat UNIX-LISTEN:$SSH_AUTH_SOCK,reuseaddr,fork -\"" "EXEC:\"socat - UNIX:${SSH_AUTH_SOCK}\"" &
echo "Waiting ..."
sleep 2
SOCATID=$(docker container ls --all -q -f name=l3d_socat)
if [[ -n ${SOCATID} ]]; then
echo "All set!"
exit 0
fi
exit 1
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment