New Portainer setup
# create persistent volume for portainer data
docker volume create --driver local portainer
# create portainer container
docker run -d \
-p 8000:8000 \
-p 9443:9443 \
--name portainer \
--restart=always \
-v /var/run/docker.sock:/var/run/docker.sock \
-v portainer:/data \
portainer/portainer-ce:latest
# install docker agent on remote server if you want to manage it from another portainer installation
docker run -d \
-p 9001:9001 \
--name portainer_agent \
--restart=always \
-v /var/run/docker.sock:/var/run/docker.sock \
-v /var/lib/docker/volumes:/var/lib/docker/volumes \
portainer/agent:latest
# NOTE: When docker is installed via snap (like the auto install when loading Ubuntu server) the volumes directory is here instead
/var/snap/docker/common/var-lib-docker/volumes
No Comments