-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
How to view log of a container created by runc? #1716
Comments
The reason why
|
Hi @cyphar , Thanks for your reply. Do you mean that i can use Thanks! |
I tried the following thing but it does not work ...
The error is
|
After digging into the code, you can redirect the stdio as you do in a normal bash script if you disable terminal in the config.json and you have to run in detach mode. So the below will work
The 2nd is quite confusing for me. Because usually you don't do IO redirection for detached process. I think it would be a lot better if I can use flag to redirect the log to a file. |
The semantics you've just described is what I meant when I said:
Now, the reason why this is the case is quite complicated (and you've stepped into quite a long and complicated history here). I'll try to explain this as best I can. One of the key features (and design constraints) of runc is that we do not have any daemons at all. No long-running processes are used in the maintenance of containers. While this is nice from the point of view of people who build stuff on top of runc (namely they don't need to care about what our code does after the container has been started), it does mean that certain APIs are a bit stranger than what you're probably used to. This is because our constraints change what we can reasonably do. If you run a container in detached mode, then all of the IO has to be handled by the user of The idea is that this is semantically equivalent to when you run most programs that
"Detach" is probably not the right choice of words on our part. When you run a container in "detached" mode (or you start the container with But this really is a fairly common source of confusion for people, so I'm wondering if there's a better way of explaining this. My main problem with proposals like this:
Is that having a I also wanted to mention that your usage of |
Hi @cyphar , Thank for your very detail response. I understand the reason why the cli interface is designed this way. Actually, if I approach at library level and use Anyway, this is great and thanks again for guiding me through the ticket! |
Well, I also happen to think the |
hello , i don not konw ,how to set runc log path? can you help me ? |
Hi,
I was searching around a lot before asking this question. Once I create a detached runc container, how do i retrieve the log (stdout, stderr) of the container? In docker, I would use
docker logs
but i don't know how to do this with runc yet.Please advise.
Thanks!
The text was updated successfully, but these errors were encountered: