compose icon indicating copy to clipboard operation
compose copied to clipboard

Absolute path conversion needs more work when using multiple yaml files from different directories

Open LantosIstvan opened this issue 3 years ago • 0 comments

Description

I have the following command to generate a yaml which used for Compose:

touch laradock/.env

docker compose \
	--env-file laradock/.env \
	-f laradock/docker-compose.yml \
	-f docker-compose.override.yml \
	convert | yq 'del(.services.logstash)' > config.yml

The ./src/apache2/startup.override.sh file's path becomes this in the generated config.yml:

/mnt/c/www-docker/laradock-wordpress/laradock/src/apache2/startup.override.sh

However, this is the route that should become:

/mnt/c/www-docker/laradock-wordpress/src/apache2/startup.override.sh

In the past, Compose generated relative paths for volumes, but I think smething has changed in Compose or Docker Engine's latest releases.

I think Compose should:

  • Have an option to use relative paths
  • Or respect the override file's relative path and interpret to absolute paths relative to that file

This was the same with Docker Desktop, now I use WSL2 Ubuntu alone. The behaviour is the same.

I should note that I parsing the environment variables with shdotenv, because I will rewrite some of Laradock's values with another environment variables, so I merge laradock/.env.example and .env files together. In this case, the mandatory .env file requirement from Docker Compose is annoying. That's why I have the empty laradock/.env file there.

Additional information you deem important (e.g. issue happens only occasionally):

Output of docker compose version:

Docker Compose version v2.9.0

Output of docker info:

Client:
 Context:    default
 Debug Mode: false
 Plugins:
  app: Docker App (Docker Inc., v0.9.1-beta3)
  buildx: Docker Buildx (Docker Inc., v0.8.2-docker)
  compose: Docker Compose (Docker Inc., v2.9.0)
  scan: Docker Scan (Docker Inc., v0.17.0)

Server:
 Containers: 1
  Running: 0
  Paused: 0
  Stopped: 1
 Images: 1
 Server Version: 20.10.17
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Native Overlay Diff: true
  userxattr: false
 Logging Driver: json-file
 Cgroup Driver: cgroupfs
 Cgroup Version: 1
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
 Swarm: inactive
 Runtimes: runc io.containerd.runc.v2 io.containerd.runtime.v1.linux
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 0197261a30bf81f1ee8e6a4dd2dea0ef95d67ccb
 runc version: v1.1.3-0-g6724737
 init version: de40ad0
 Security Options:
  seccomp
   Profile: default
 Kernel Version: 5.10.102.1-microsoft-standard-WSL2
 Operating System: Ubuntu 20.04.4 LTS
 OSType: linux
 Architecture: x86_64
 CPUs: 12
 Total Memory: 15.58GiB
 Name: LANTI-DESKTOP
 ID: L3OC:RJAT:B5SO:B2XT:L3AB:ON27:PFPS:6WTO:IHMX:DP6B:4IIV:BAXY
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 Registry: https://index.docker.io/v1/
 Labels:
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false

WARNING: No blkio throttle.read_bps_device support
WARNING: No blkio throttle.write_bps_device support
WARNING: No blkio throttle.read_iops_device support
WARNING: No blkio throttle.write_iops_device support

LantosIstvan avatar Aug 08 '22 20:08 LantosIstvan