Is it possible to combine “docker logs” output and

2020-03-07 05:43发布

问题:

Is it possible that merging docker logs -f output and docker exec result? I already tried to redirect docker exec results to docker logs file. My environment that host is MacOS and run ubuntu docker image.

回答1:

You can run

docker exec -it <container id> sh -c "ls -alh  > /proc/1/fd/1"

sh -c is required so that your shell doesn't interpret the redirection



标签: docker