Skip to content
This repository was archived by the owner on Feb 16, 2023. It is now read-only.

Commit c89e857

Browse files
authored
Merge pull request #16 from linuxserver/run.sh
Update run.sh with changes from upstream.
2 parents 77ea2e2 + 838e4e8 commit c89e857

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

readme-vars.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,9 @@ full_custom_readme: |
7878
up
7979
```
8080
You can replace the last line with any docker-compose command and argument, which will be passed to docker-compose inside the image.
81-
81+
8282
### Recommended method
83-
83+
8484
We provide a very convenient script that allows the docker-compose container to run as if it was installed natively:
8585
```
8686
sudo curl -L --fail https://raw.githubusercontent.com/linuxserver/docker-docker-compose/master/run.sh -o /usr/local/bin/docker-compose
@@ -131,6 +131,7 @@ full_custom_readme: |
131131
132132
## Versions
133133
134+
* **04.10.20:** - Update run.sh with changes from upstream.
134135
* **31.08.20:** - Update tox and virtualenv.
135136
* **31.07.20:** - Add support for global env var `DOCKER_COMPOSE_IMAGE_TAG` in the `run.sh` script.
136137
* **06.07.20:** - Publish docker-compose and docker-cli binaries in Github releases.

run.sh

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@ IMAGE="linuxserver/docker-compose:$DOCKER_COMPOSE_IMAGE_TAG"
2626

2727
# Setup options for connecting to docker host
2828
if [ -z "$DOCKER_HOST" ]; then
29-
DOCKER_HOST="/var/run/docker.sock"
29+
DOCKER_HOST='unix:///var/run/docker.sock'
3030
fi
31-
if [ -S "$DOCKER_HOST" ]; then
32-
DOCKER_ADDR="-v $DOCKER_HOST:$DOCKER_HOST -e DOCKER_HOST"
31+
if [ -S "${DOCKER_HOST#unix://}" ]; then
32+
DOCKER_ADDR="-v ${DOCKER_HOST#unix://}:${DOCKER_HOST#unix://} -e DOCKER_HOST"
3333
else
3434
DOCKER_ADDR="-e DOCKER_HOST -e DOCKER_TLS_VERIFY -e DOCKER_CERT_PATH"
3535
fi
@@ -41,7 +41,13 @@ if [ "$(pwd)" != '/' ]; then
4141
fi
4242
if [ -n "$COMPOSE_FILE" ]; then
4343
COMPOSE_OPTIONS="$COMPOSE_OPTIONS -e COMPOSE_FILE=$COMPOSE_FILE"
44-
compose_dir=$(realpath "$(dirname "$COMPOSE_FILE")")
44+
compose_dir="$(dirname "$COMPOSE_FILE")"
45+
# canonicalize dir, do not use realpath or readlink -f
46+
# since they are not available in some systems (e.g. macOS).
47+
compose_dir="$(cd "$compose_dir" && pwd)"
48+
fi
49+
if [ -n "$COMPOSE_PROJECT_NAME" ]; then
50+
COMPOSE_OPTIONS="-e COMPOSE_PROJECT_NAME $COMPOSE_OPTIONS"
4551
fi
4652
# TODO: also check --file argument
4753
if [ -n "$compose_dir" ]; then

0 commit comments

Comments
 (0)