GitHub上的 poratiner部署方式

sudo docker volume create portainer_data    
sudo docker run -d -p 9000:9000 -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer

Web访问 127.0.0.1:9000

user: admin
password: tryportainer

docker-compose

curl -L https://downloads.portainer.io/portainer-agent-stack.yml -o portainer-agent-stack.yml
docker stack deploy --compose-file=portainer-agent-stack.yml portainer

官方网址

编写docker-compose.yml 文本本件

1、创建docker-compose.yml
       touch docker-compose.yml
2、编辑  vim  docker-compose.yml
3、写入内容

version: '2'
services:
    portainer:
      image: portainer/portainer
      restart: always
      ports:
        - "9000:9000"
      volumes:
        - /var/run/docker.sock:/var/run/docker.sock
        - /data/docker/portainer/data:/data

浏览器中输入http://ip:9000即可访问

用户名默认 admin

密码为宿主机密码

cat  >>docker-compose.yml <<'EOF'
version: '2'
services:
  portainer:
    image: portainer/portainer
    command: -H unix:///var/run/docker.sock
    restart: always
    ports:
      - 9000:9000
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - portainer_data:/data

volumes:
  portainer_data:

EOF