system:init:systemd

Systemd

[Unit]
Description=Portainer service with docker-compose
Requires=docker.service
After=docker.service
 
[Service]
Restart=always
 
WorkingDirectory=/var/lib/jenkins/workspace/portainer/
 
# Remove old containers, network and volumes
ExecStartPre=/usr/bin/docker-compose -f /var/lib/jenkins/workspace/portainer/docker-compose.yml down -v
ExecStartPre=-/bin/bash -c 'docker network rm docker_jfrog_net'
ExecStartPre=-/bin/bash -c 'docker ps -aqf "name=artifactory" | xargs docker rm'
 
# Compose up
ExecStart=/usr/bin/docker-compose -f /var/lib/jenkins/workspace/portainer/docker-compose.yml up
 
# Compose down, remove containers
ExecStop=/usr/bin/docker-compose -f /var/lib/jenkins/workspace/portainer/docker-compose.yml down
 
[Install]
WantedBy=multi-user.target
  • system/init/systemd.txt
  • Последнее изменение: 2019/12/09 23:10
  • mirocow