'Stop Docker Container from always restarting

I have once run portainer (official image). Now it is always restarting after boot and after i stop it.

I changed the restart policy with docker update.

When I run docker inspect on the container i see:

"RestartPolicy": {
    "Name": "",
    "MaximumRetryCount": 0
},

When I use docker update and explicitly set the RestartPolicy to "no", and then stop the container, it restarts anyway (a new container based on the same image) and the RestartPolicy is set to the above again.

I purged everything using docker system purge -a

When stopping the container and immediatly removing the image, it says it cannot delete because there is a container running. (Which is true, because it immediatly restarts)

I even uninstalled docker and removed ~/.docker and then reinstalled docker. Upon startup of the docker daemon, the container was running again.

I really don't understand what else I can do. But I don't need and don't want Portainer running anymore.



Solution 1:[1]

You will need to run this command to stop restarting your container:

docker update --restart=no container-name

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Moses Nandwa