Portainer on Docker / Podman

Portainer on Docker / Podman

Portainer,用来管理容器。

Podman 相关内容参考:podman support - github

portainer-ce

docker

docker volume create portainer_data
docker run -d -p 9443:9443 \
    -v /var/run/docker.sock:/var/run/docker.sock \
    -v portainer_data:/data \
    --restart=always \
    --name portainer \
    portainer/portainer-ce

podman root

podman volume create portainer_data
podman run -d -p 9443:9443 \
    -v /run/podman/podman.sock:/var/run/docker.sock:Z \
    -v portainer_data:/data \
    --restart=always \
    --name portainer \
    portainer/portainer-ce

podman rootless

systemctl --user enable --now podman.socket
podman volume create portainer_data
podman run -d -p 9443:9443 \
    -v /run/user/$(id -u)/podman/podman.sock:/var/run/docker.sock:Z \
    -v portainer_data:/data \
    --security-opt label=disable \
    --name=portainer \
    --restart=always \
    portainer/portainer-ce

portainer-agent

docker

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 \
    -v /:/host \
    portainer/agent

podman root

mkdir -p /var/lib/containers/storage/volumes
podman run -d -p 9001:9001 \
    --name portainer_agent \
    --restart=always \
    -v /run/podman/podman.sock:/var/run/docker.sock:Z \
    -v /var/lib/containers/storage/volumes:/var/lib/docker/volumes \
    -v /:/host \
    portainer/agent

podman rootless

systemctl --user enable --now podman.socket
podman run -d -p 9001:9001 \
    --name portainer_agent \
    --security-opt label=disable \
    --restart=always \
    -v /run/user/$(id -u)/podman/podman.sock:/var/run/docker.sock:Z \
    -v ${HOME}/.local/share/containers/storage/volumes:/var/lib/docker/volumes \
    -v /:/host \
    portainer/agent