How to reboot centos in docker?

Viewed 2560

How to reboot centos in docker ?

I had pulled centos 7 from docker

use the 'shutdown -r now'

The console said 'Failed to talk to init daemon.'

I also used 'reboot -f' , and get the 'Rebooting. Failed to reboot: Operation not permitted' for rsp

2 Answers

Why you want to restart container?

if it is necessary you can use docker exec -it <container name> reboot or you can stop container and start it again docker stop -f <container name> then docker start <container name>

Assuming you are logged in to your container and trying to "reboot" the container:

e.g. docker run -i -t centos /bin/bash and then reboot

You shouldn't do is.

Please use docker run/start/stop....

Related