1

I have a docker-compose project that I would like to control through systemd. I have the next file in systemd.

[Unit]
Description=My Server container
Requires=docker.service
After=docker.service

[Service]
Restart=always
ExecStart=/usr/local/bin/docker-compose -f /home/adminuser/project/docker-compose.yml up
ExecStop=/usr/local/bin/docker-compose -f /home/adminuser/project/docker-compose.yml stop

[Install]
WantedBy=multi-user.target

This file I've test in instances in Amazon Web Services successful. My service run every I reboot, but actually I need implementation the service in a Server hp proliant microserver gen8 where I have installed Ubuntu Server 16.04, unfortunately when I reboot the server, The service can't start my docker project.

it was show error.

● backend.project.service - My Server container
   Loaded: loaded (/etc/systemd/system/backend.sssirsa.service; enabled; vendor preset: enabled)
   Active: failed (Result: start-limit-hit) since mar 2016-11-15 09:38:26 CST; 1h 17min ago
  Process: 3469 ExecStop=/usr/local/bin/docker-compose -f /home/adminuser/project/docker-compose.yml stop (code=exited, status=1/FAILURE)
  Process: 3461 ExecStart=/usr/local/bin/docker-compose -f /home/adminuser/project/docker-compose.yml up (code=exited, status=1/FAILURE)
 Main PID: 3461 (code=exited, status=1/FAILURE)

nov 15 09:38:26 PROJECT systemd[1]: backend.project.service: Unit entered failed state.
nov 15 09:38:26 PROJECT systemd[1]: backend.project.service: Failed with result 'exit-code'.
nov 15 09:38:26 PROJECT systemd[1]: backend.project.service: Service hold-off time over, scheduling restart.
nov 15 09:38:26 PROJECT systemd[1]: Stopped My Server container.
nov 15 09:38:26 PROJECT systemd[1]: backend.project.service: Start request repeated too quickly.
nov 15 09:38:26 PROJECT systemd[1]: Failed to start My Server container.
nov 15 09:38:26 PROJECT systemd[1]: backend.project.service: Unit entered failed state.
nov 15 09:38:26 PROJECT systemd[1]: backend.project.service: Failed with result 'start-limit-hit'.

I try many solutions as:

  • Add my user adminuser to docker group
  • Add chmood 777 to service file
  • Add in init.d directory

But nothing help me for resolve my problem

I hope someone can help me in my problem.

carson314
  • 11
  • 2

0 Answers0