nginxinc / nginx-amplify-agent

NGINX Amplify Agent
BSD 2-Clause "Simplified" License
23 stars 9 forks source link

Autostart containerized Amplify-agent after restart (reboot server) #63

Open podguzovvasily opened 4 years ago

podguzovvasily commented 4 years ago

Dear developers and community. I've installed Amplify-agent inside docker container, and agent works well. But how can I add autostart of amplify-agent when container will restarted or whole system rebooted?

P.S. I've used nginx:1.19.2 and install.sh for the agent installation. Thanks!

miroslavrussev commented 3 years ago

Hello there,

I needed the same thing so my current solution to this is as follows:

  1. Create a file inside /docker-entrypoint.d/ called 40-start-amplify.sh
  2. Make it executable chmod 775 /docker-entrypoint.d/40-start-amplify.sh
  3. Add the necessary command to start the agent-amplify service:
    
    #!/bin/sh
    # vim:sw=2:ts=2:sts=2:et

service amplify-agent start


4.  Save, exit and restart the container

I hope this helps!