Disable auto restart policy of docker container

If a docker container is started with –restart=always, then the container will not allow you to stop it.  We can change this behavior by modifying the restart policy. Refer the docker  official documentation for more info

For example

docker run -d --restart=always -p 80:80 -it nginx

To modify this behavior, try the following command.

docker update --restart=no your-container

Another option that allows us to stop the container manually is

docker update --restart=unless-stopped your-container

Programmatic way to reboot EC2 instances

Sometimes we might have to reboot EC2 instances. If the requirement is to restart EC2 instances regularly, we can achieve it by writing a small piece of code. I also came across a similar requirement and a portion of the code I used is given below.