Work correctly
$ docker-compose exec app sh
Traceback (most recent call last):
File "docker-compose", line 6, in <module>
File "compose\cli\main.py", line 72, in main
File "compose\cli\main.py", line 128, in perform_command
File "compose\cli\main.py", line 491, in exec_command
File "compose\cli\main.py", line 1469, in call_docker
File "subprocess.py", line 172, in call
File "subprocess.py", line 394, in __init__
File "subprocess.py", line 644, in _execute_child
TypeError: environment can only contain strings
[9644] Failed to execute script docker-compose
version: "3"
services:
app:
build: docker/php
volumes:
- ./:/app
env_file:
- .env
docker-compose exec app sh
- work correctlyAPP_ENV=development
docker-compose exec app sh
- error: environment can only contain stringsFor now, I have solved it accessing the bash through the Cli on the windows-docker application:
I hope it helps you too.
A workaround that was working for me was to run the command using --log-level=DEBUG
. Now before the error message a line is printed like
'C:\Program Files\Docker\Docker\Resources\bin\docker.exe' start --attach --interactive ab554a8aa626929dba218571606f6379e9b87edc11ac4311a94f4b3752a4b79f
when copy pasted back into the terminal this works as expected.
I have the same issue. I am able to run docker exec -ti app sh
instead of using docker-compose
for now.
I also have the described issue.
Removing only the comments from my .env
file did not do the trick. Also I tried to change the encoding to UTF8-with-BOM, no luck either.
Workaround: If I transfer the contents of the .env
file into environment
section of docker-compose.yml
file and clear the .env
file it works (which leaves me with uncommited changes though).
Fixed by https://github.com/docker/compose/pull/7183
You can find a new release with the fix at https://github.com/docker/compose/releases/tag/1.25.3
Solution reported by @ulyssessouza seems work for me! Thanks!
First of all I can confirm that the version 1.25.3 fix the problem. And it is also nice that there is allready a solutuion for that problem.
What I totaly don't get is how it is delivred. I Installed the desktop app today and run straight into that problem. That I had to spend a lot of time on a bug that is already fixed. Where is the point on not deliver the newest version and don't give a option to update it on the app it self? The app only installs 1.25.2 right now and tell you all is up to date.
@BenjaminQuandt an workaround for the update problem would be to get the .exe from the release page ( https://github.com/docker/compose/releases/tag/1.25.4 for example ), rename it to docker-compose.exe and put it in the docker executables path ( Docker\Docker\resources\bin ). Would recommend doing an backup to the old docker-compose executable.
Most helpful comment
For now, I have solved it accessing the bash through the Cli on the windows-docker application:
I hope it helps you too.