nsenter

CoreOS - get docker container name by PID?

假如想象 提交于 2020-06-24 07:21:17
问题 I have a list of PID's and I need to get their docker container name. Going the other direction is easy ... get PID of docker container by image name: $ docker inspect --format '{{.State.Pid}}' {SOME DOCKER NAME} Any idea how to get the name by PID? 回答1: Something like this? $ docker ps -q | xargs docker inspect --format '{{.State.Pid}}, {{.ID}}' | grep "^${PID}," [EDIT] Disclaimer This is for "normal" linux. I don't know anything useful about CoreOS, so this may or may not work there. 回答2:

How to edit a file dynamically in a running docker container

谁说胖子不能爱 提交于 2019-12-21 20:35:08
问题 Background I had build a npm server(sinopia) docker image(https://github.com/feuyeux/docker-atue/blob/master/docker-images/feuyeux_sinopia.md), and in the CMD line, it will run the start.sh every time when the container is generated. CMD ["/opt/sinopia/start.sh"] This shell will create a yaml file dynamically. sed -e 's/\#listen\: localhost/listen\: 0.0.0.0/' -e 's/allow_publish\: admin/allow_publish\: all/' /tmp/config.yaml > /opt/sinopia/config.yaml Question I wish I could edit this config

How to edit a file dynamically in a running docker container

拟墨画扇 提交于 2019-12-04 14:09:06
Background I had build a npm server(sinopia) docker image( https://github.com/feuyeux/docker-atue/blob/master/docker-images/feuyeux_sinopia.md ), and in the CMD line, it will run the start.sh every time when the container is generated. CMD ["/opt/sinopia/start.sh"] This shell will create a yaml file dynamically. sed -e 's/\#listen\: localhost/listen\: 0.0.0.0/' -e 's/allow_publish\: admin/allow_publish\: all/' /tmp/config.yaml > /opt/sinopia/config.yaml Question I wish I could edit this config.yaml when the container is running, because I hope the content should be changed on demand. see the

Docker exec versus nsenter: Any gotchas?

随声附和 提交于 2019-11-29 10:04:55
I've been using nsenter for the last few months to get a shell running on a container for debugging purposes. I have heard about and used docker exec which was introduced in version 1.3. Docker exec seems to be the new best practice for the purpose of getting inside a container for debugging purposes, but I'm wondering if there are any drawbacks to using docker exec versus nsenter. Information comparing the two is scant. Are there any specific problems I should watch out for or avoid when using docker exec versus nsenter? That is not entirely clear right now. But I would support the view that

Docker exec versus nsenter: Any gotchas?

萝らか妹 提交于 2019-11-28 03:51:11
问题 I've been using nsenter for the last few months to get a shell running on a container for debugging purposes. I have heard about and used docker exec which was introduced in version 1.3. Docker exec seems to be the new best practice for the purpose of getting inside a container for debugging purposes, but I'm wondering if there are any drawbacks to using docker exec versus nsenter. Information comparing the two is scant. Are there any specific problems I should watch out for or avoid when