Skip to content

output of CODER_SETUP_SCRIPT is not logged if running headless #394

Closed
@johnstcn

Description

@johnstcn

Motivation

If you're trying to troubleshoot issues with ENVBUILDER_SETUP_SCRIPT, you would most likely need to view the log output.

I've noticed that if running envbuilder with no stdout/stdin attached, you end up missing the log output:

Example (main@aba2f46):

$ docker run -d -e ENVBUILDER_GIT_URL=https://github.com/coder/envbuilder-starter-devcontainer -e ENVBUILDER_INIT_SCRIPT='bash' -e ENVBUILDER_SETUP_SCRIPT="echo 'setting up...'; sleep 3; echo 'done' | tee /setup.log" envbuilder:latest
envbuilder v1.0.3+dev-aba2f46 - Build development environments from repositories in a container
[...]
=== Running the setup command "echo 'setting up...'; sleep 3; echo 'done' | tee /setup.log" as the root user...
=== Running init command as user "coder": ["/bin/sh" "-c" "bash"]

Whereas running with a terminal attached results in the logs becoming visible:

docker run -it -e ENVBUILDER_GIT_URL=https://github.com/coder/envbuilder-starter-devcontainer -e ENVBUILDER_INIT_SCRIPT='bash' -e ENVBUILDER_
SETUP_SCRIPT="echo 'setting up...'; sleep 3; echo 'done' | tee /setup.log" envbuilder:latest
envbuilder v1.0.3+dev-aba2f46 - Build development environments from repositories in a container
[...]
=== Running the setup command "echo 'setting up...'; sleep 3; echo 'done' | tee /setup.log" as the root user...
setting up...
done
=== Running init command as user "coder": ["/bin/sh" "-c" "bash"]
🐳 5a1e4fa7be68 envbuilder-starter-devcontainer #  

Workaround

Redirect or tee the output to some file (as shown in the above examples).

Proposed Solution

Not sure yet!

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions