Page tree

Versions Compared

Key

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

...

No Format
WD=/opt/dcontainer/setup
cat << EOF >$WD/dcontainer.service.setup.sh
cat << EOL >/lib/systemd/system/dcontainer.service
[Unit]
Description=dcontainer_Docker
Requires=docker.service network-online.target

[Service]  

WorkingDirectory=$WD
ExecStartPre=docker-compose pull
Restart=on-abnormal
ExecStart=docker-compose pull ExecStart=/usr/bin/docker-compose --project-name dcontainer --project-directory $WD -f $WD/docker-compose.yaml up --force-recreate
ExecStop=/usr/bin/docker-compose --project-name dcontainer --project-directory $WD -f $WD/docker-compose.yaml stop

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

...