You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
My docker-compose.yml lives inside some github checkout subdirectory.
As an admin, I make a symlink 'o' in my home, that brings me there.
changing directory to the real path, I run docker compose up -d
Then, when using the symlink, docker compose commands either silently do nothing, or produce an error.
When using the real path, the same docker compose commands work just fine.
(Also the other way around: You always have to use the symlink after starting with cd ~/o; docker compose up -d)
docker compose ls shows which variant works.
Expected behavior:
It should make no difference, how I navigated my shell to the project directory.
Steps To Reproduce
# cd
# mkdir -p tedious-long/path/for/testing
# ln -s tedious-long/path/for/testing o
# cat <<EOF > o/docker-compose.yml
---
services:
hello:
image: ubuntu:latest
command: [ 'bash', '-c', 'while true; do date; sleep 1; done' ]
EOF
# cd tedious-long/path/for/testing
# ls -la
total 12
drwxr-xr-x 2 root root 4096 Jul 26 11:18 .
drwx------ 10 root root 4096 Jul 26 12:14 ..
-rw-r--r-- 1 root root 117 Jul 26 11:18 docker-compose.yml
docker compose up -d
# cd ~/o
# ls -la
total 12
drwxr-xr-x 2 root root 4096 Jul 26 11:18 .
drwx------ 10 root root 4096 Jul 26 12:14 ..
-rw-r--r-- 1 root root 117 Jul 26 11:18 docker-compose.yml
# docker compose logs
# cd ~/tedious-long/path/for/testing
# docker compose logs
hello-1 | Fri Jul 26 12:38:04 UTC 2024
hello-1 | Fri Jul 26 12:38:05 UTC 2024
hello-1 | Fri Jul 26 12:38:06 UTC 2024
hello-1 | Fri Jul 26 12:38:07 UTC 2024
hello-1 | Fri Jul 26 12:38:08 UTC 2024
hello-1 | Fri Jul 26 12:38:09 UTC 2024
hello-1 | Fri Jul 26 12:38:10 UTC 2024
hello-1 | Fri Jul 26 12:38:11 UTC 2024
hello-1 | Fri Jul 26 12:38:12 UTC 2024
hello-1 | Fri Jul 26 12:38:13 UTC 2024
hello-1 | Fri Jul 26 12:38:14 UTC 2024
# cd ~/o
# docker compose logs
# docker compose exec hello id
service "hello" is not running
# cd ~/tedious-long/path/for/testing
# docker compose exec hello id
uid=0(root) gid=0(root) groups=0(root)
I can see several usages of EvalSymlinks() in pkg/compose/watch.go, but none in e.g. cmd/compose/compose.go
Please note that filepath.Abs(".") happily constructs absolute paths with unresolved symlinks. That's a pity, as it is often used.
I tested the symlink behaviour with:
Description
My docker-compose.yml lives inside some github checkout subdirectory.
As an admin, I make a symlink 'o' in my home, that brings me there.
changing directory to the real path, I run
docker compose up -d
Then, when using the symlink, docker compose commands either silently do nothing, or produce an error.
When using the real path, the same docker compose commands work just fine.
(Also the other way around: You always have to use the symlink after starting with
cd ~/o; docker compose up -d
)docker compose ls
shows which variant works.Expected behavior:
It should make no difference, how I navigated my shell to the project directory.
Steps To Reproduce
Workaound
In bash, use
set -o physical
Compose Version
Docker Environment
Anything else?
I can see several usages of EvalSymlinks() in pkg/compose/watch.go, but none in e.g. cmd/compose/compose.go
Please note that
filepath.Abs(".")
happily constructs absolute paths with unresolved symlinks. That's a pity, as it is often used.I tested the symlink behaviour with:
My assumption is that golang's filepath.Abs() happily relies on the PWD environment variable from the shell, which is weird.
The text was updated successfully, but these errors were encountered: