devcontainers / devcontainers/cli
devcontainer up trims docker command in logs
- Dominant language
- TypeScript
- Stars
- 3k
- Forks
- 457
- Avg merge
- 13h 17m
- Merged PRs (30d)
- 6
Description
When launching a devcontainer, the docker command being logged is not the same command that is actually being passed to docker. This is due to the logger replacing everything after the new line with an empty space: https://github.com/devcontainers/cli/blob/a48200c005724ddaecae3ed6b188a7d99ca482a4/src/spec-common/commonUtils.ts#L329
and the arguments containing a new lines https://github.com/devcontainers/cli/blob/a48200c005724ddaecae3ed6b188a7d99ca482a4/src/spec-node/singleContainer.ts#L381
Ideally the command being logged should be exactly what is being passed to docker.
Current log output of the command:
```
docker run --sig-proxy=false -a STDOUT -a STDERR --mount source=/dev,target=/workspace,type=bind --mount type=bind,src=/var/run/docker.sock,dst=/var/run/docker-host.sock -l devcontainer.local_folder=/dev -l devcontainer.config_file=/dev/.devcontainer/devcontainer.json --entrypoint /bin/sh vsc-c5067b6e1911c7c50ffae27b6e3a0b6304f4375a5b0021508f278d172f3835a8-features-uid -c echo Container started
```
when the actual docker execution is:
```
docker run --sig-proxy=false -a STDOUT -a STDERR --mount source=/dev,target=/workspace,type=bind --mount type=bind,src=/var/run/docker.sock,dst=/var/run/docker-host.sock -l devcontainer.local_folder=/dev -l devcontainer.config_file=/dev/.devcontainer/devcontainer.json --entrypoint /bin/sh vsc-c5067b6e1911c7c50ffae27b6e3a0b6304f4375a5b0021508f278d172f3835a8-features-uid -c echo Container started
trap "exit 0" 15
/usr/local/share/docker-init.sh
exec "$@"
while sleep 1 & wait $!; do :; done -
```
It would be nice to format the log correctly to make it easy to recreate the container for testing
Contributor guide
Assessment
This issue has not been assessed yet.