[英]Podman (docker) container
Does someone know how to start and stop services inside the container?有人知道如何在容器内启动和停止服务吗?
Eg wish to stop sshd service INSIDE the Ubuntu container, but not in the whole host (RHEL).例如,希望在 Ubuntu 容器内停止 sshd 服务,而不是在整个主机 (RHEL) 中。
您需要使用docker exec -it <container_name> /bin/bash
在容器中获取一个 root shell,然后您可以运行您想要的命令
Log in to the container using the below command使用以下命令登录容器
docker exec -it <container_id> /bin/bash
Using any of the below commands can stop the ssh service使用以下任何命令都可以停止 ssh 服务
$ sudo /etc/init.d/ssh stop
or $ sudo service ssh stop
or $ sudo systemctl stop ssh
$ sudo /etc/init.d/ssh stop
或$ sudo service ssh stop
或$ sudo systemctl stop ssh
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.