slim
slim copied to clipboard
docker-compose.yml: no such file or directory
Expected Behavior
running docker-compose.yaml through the docker-slim container with success using the following command:
docker run -it --rm -v /var/run/docker.sock:/var/run/docker.sock dslim/docker-slim build --compose-file docker-compose.yaml --http-probe=false --target-compose-svc api
Actual Behavior
Gettting this error while running the command: time="2022-11-27T14:39:15Z" level=fatal msg="docker-slim: failure" error="open /docker-compose.yml: no such file or directory" stack="goroutine 1 [running]:\nruntime/debug.Stack()\n\truntime/debug/stack.go:24 +0x65\ngithub.com/docker-slim/docker-slim/pkg/util/errutil.FailOn({0x1e61ba0, 0xc00013aba0})\n\tgithub.com/docker-slim/docker-slim/pkg/util/errutil/errutil.go:28 +0x5e\ngithub.com/docker-slim/docker-slim/pkg/app.(*ExecutionContext).FailOn(0x0?, {0x1e61ba0?, 0xc00013aba0?})\n\tgithub.com/docker-slim/docker-slim/pkg/app/execontext.go:56 +0x49\ngithub.com/docker-slim/docker-slim/pkg/app/master/commands/build.OnCommand(_, , {, _}, , {, }, {, _}, {0x0, ...}, ...)\n\tgithub.com/docker-slim/docker-slim/pkg/app/master/commands/build/handler.go:366 +0x5c7d\ngithub.com/docker-slim/docker-slim/pkg/app/master/commands/build.glob..func1(0xc000622e40)\n\tgithub.com/docker-slim/docker-slim/pkg/app/master/commands/build/cli.go:607 +0x4730\ngithub.com/urfave/cli/v2.(*Command).Run(0x2c12b00, 0xc00003c1c0)\n\tgithub.com/urfave/cli/[email protected]/command.go:163 +0x5bb\ngithub.com/urfave/cli/v2.(*App).RunContext(0xc0006a2340, {0x1e785d8?, 0xc000042030}, {0xc00003a0a0, 0xa, 0xa})\n\tgithub.com/urfave/cli/[email protected]/app.go:313 +0xb48\ngithub.com/urfave/cli/v2.(*App).Run(...)\n\tgithub.com/urfave/cli/[email protected]/app.go:224\ngithub.com/docker-slim/docker-slim/pkg/app/master.Run()\n\tgithub.com/docker-slim/docker-slim/pkg/app/master/app.go:15 +0x46\nmain.main()\n\tgithub.com/docker-slim/docker-slim/cmd/docker-slim/main.go:15 +0x1aa\n" version="linux|Transformer|1.39.1|537c77323f2e9a3d6771aa0ea73a047017774d16|2022-11-13_04:56:24AM"
Am i doing something wrong?
Specifications
- Version: 1.39
- Platform: Windows 10 22H2 using docker-slim via docker.
METO with: sudo docker run -it --rm -v /var/run/docker.sock:/var/run/docker.sock dslim/slim build --http-probe=false --compose-file docker-compose.yml --target-compose-svc web --network=revproxy_default bizzaro1_web:latest
@TonyRogers with the containerized version the files you reference in --compose-file
(or any other -file flag like --include-path-file
, etc) need to be accessible by the container where the app runs. This requires a volume mount.
Your call should look something like this: sudo docker run -it --rm -v /var/run/docker.sock:/var/run/docker.sock -v /your/local/path/to/docker-compose.yml:/some/path/docker-compose.yml dslim/slim build --http-probe=false --compose-file /some/path/docker-compose.yml --target-compose-svc web --network=revproxy_default bizzaro1_web:latest
Ah, ok. I'm struggling a bit to 'get going'. That is presumably how I get to the .env file too?
Yes
The easiest thing to do is to mount a local dir with all your files and then reference the files in that dir in the flags. That way you need to have only a single volume mount.
Let me know if you have any other questions