Create a volume to store the portainer data
docker volume create portainer_data
docker run \
-d \
-p 8000:8000 \
-p 9443:9443 \
--name portainer \
--restart=unless-stopped \
-v /var/run/docker.sock:/var/run/docker.sock \
-v portainer_data:/data \
portainer/portainer-ce:2.20.3-alpine
Command explanation:
- Run the portainer/portainer-ce image.
- Map container port 9443 to host port 9000.
- Run the container in detached mode (-d) and restart it automatically (--restart unless-stopped).
- Name the container portainer.
- Create a volume named portainer_data and mount it to the /data directory within the container (-v portainer_data:/data).
Top comments (0)