I bought a Raspberry Pi 4 recently. I wanted to install Portainer to manage my containers on it. I used unless-stopped
restart policy. The default one mentioned in the original documents, always
, make it start again when stop command is given.
docker run --name portainer --restart=unless-stopped -d -p 8000:8000 -p 9000:9000 -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer
To update, I use below commands.
sudo docker pull portainer/portainer
sudo docker stop portainer
sudo docker rm portainer
docker run --name portainer --restart=unless-stopped -d -p 8000:8000 -p 9000:9000 -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer