Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Usage with docker #32

Closed
flohw opened this issue Dec 13, 2017 · 4 comments
Closed

Usage with docker #32

flohw opened this issue Dec 13, 2017 · 4 comments

Comments

@flohw
Copy link

flohw commented Dec 13, 2017

I want to use this tool inside a php docker container.
I get the error "Notice: Undefined index SHELL in bamarni/symfony-console-autocomplete/symfony-autocomplete on line 68"

Is it possible to run or update the scripts to be able to run inside a docker container ?

Thanks.

@rquadling
Copy link
Collaborator

Strangely enough I've just seen the same issue.
docker exec -it php bash gives me a shell prompt inside my PHP-FPM container.
Running set | grep SHELL and I see SHELL=/bin/bash.
Running php -i | grep SHELL and I get nothing. My variables_order doesn't include E, so no environment variables added, but even php -d variables_order=EPGCS -i | grep SHELL yields no joy.

I think, if you want to run this, you'll need to provide the shell value manually using the --shell option (see https://github.com/bamarni/symfony-console-autocomplete/blob/master/src/DumpCommand.php#L23).

@rquadling
Copy link
Collaborator

php -d variables_order=GPCSE -r 'print_r($_ENV); shows the environment variables that are being presented to PHP in the docker container. No SHELL. No OS.

@rquadling
Copy link
Collaborator

Based upon moby/moby#33794, the only solution I can find at the moment is to supply the SHELL env to the docker exec command.

docker exec -e COLUMNS="tput cols" -e LINES="tput lines" -e SHELL=bash -it php bash

Running symfony-autocomplete in the container now generates the completion code without the error.

@rquadling
Copy link
Collaborator

Updated README with notes regarding the lack of the SHELL environment variable when using docker exec to connect to a container.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants