Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

No Format
cat << 'EOL' >/lib/systemd/system/portainer.service
[Unit]
Description=Portainer_Docker_Description
Requires=docker.service network-online.target

[Service]
Restart=on-abnormal
ExecStart=/usr/bin/docker start -a portainer
ExecStop=/usr/bin/docker stop -t 2 portainer

[Install]
WantedBy=multi-user.target
EOL
systemctl enable portainer
systemctl start portainer
systemctl status portainer
No Format
WD=/opt/portainer/setup
cat << EOF >$WD/portainer.service.setup.sh
cat << EOL >/lib/systemd/system/portainer.service
[Unit]
Description=portainerPortainer_Docker
Requires=docker.service network-online.target

[Service]

Restart=on-abnormal
ExecStart=/usr/bin/docker-compose --project-name portainer --project-directory $WD -f $WD/docker-compose.yaml up
ExecStop=/usr/bin/docker-compose --project-name portainer --project-directory $WD -f $WD/docker-compose.yaml stop

[Install]
WantedBy=multi-user.target
EOL
systemctl enable portainer
systemctl start portainer
EOF
chmod +x $WD/portainer.service.setup.sh
$WD/portainer.service.setup.sh

...