# Mender Server start at boot

**URL:** <https://hub.mender.io/t/mender-server-start-at-boot/1931>\
**Category:** General Discussions\
**Tags:** mender-server, container, boot\
**Created:** [May 16, 2020, 1:12pm UTC](https://hub.mender.io/t/mender-server-start-at-boot/1931 "2020-05-16T13:12:45Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![matteog](https://avatars.discourse-cdn.com/v4/letter/m/919ad9/32.png) [@matteog](https://hub.mender.io/u/matteog)\
**Post date:** [May 16, 2020, 1:12pm UTC](https://hub.mender.io/t/mender-server-start-at-boot/1931/1 "2020-05-16T13:12:45Z")

</div>

Hello,  
I’m trying to autostart the Mender production server at boot, in order to run everything unattended.  
Editing the common.yml line from

> restart: on-failure

to

> restart: unless-stopped

causes the system to boot with deployments container in perpetual restarting status.  
Web UI becomes unresponsive and crashes.  
Logs shows dial tcp to address:9000 failing with Connection refused

Giving a

> ./run stop  
> ./run up -d

fixes it.

Any clues?

---

<div class="post-metadata">

**Author:** ![dellgreen](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/dellgreen/32/85_2.png) [@dellgreen](https://hub.mender.io/u/dellgreen)\
**Post date:** [May 16, 2020, 9:08pm UTC](https://hub.mender.io/t/mender-server-start-at-boot/1931/2 "2020-05-16T21:08:35Z")

</div>

I had a similar problem and in my case I found that docker was launching mender before all required systemd services were up. In the end i configured docker to not start mender containers on boot and added my own mender systemd service to ensure the required system services were up before launching mender-server. See below for systemd service I created. Obviously your setup will be different so change the necessary values to suit

[Unit]  
Description=Mender docker embedded image upgrade services  
Requires=docker.service  
After=docker.service systemd-user-sessions.service  
After=network-online.target network.target

[Service]  
Type=simple  
TimeoutStopSec=300  
User=mender  
WorkingDirectory=/home/mender/applications/IwMenderServer/production  
ExecStart=/home/mender/applications/IwMenderServer/production/run up

[Install]  
WantedBy=multi-user.target

---

<div class="post-metadata">

**Author:** ![matteog](https://avatars.discourse-cdn.com/v4/letter/m/919ad9/32.png) [@matteog](https://hub.mender.io/u/matteog)\
**Post date:** [May 20, 2020, 8:15pm UTC](https://hub.mender.io/t/mender-server-start-at-boot/1931/3 "2020-05-20T20:15:26Z")

</div>

Thanks for your detailed solution!  
Where did you tweak docker to stop loading some containers on boot?  
I can’t find any related config line…

---

<div class="post-metadata">

**Author:** ![dellgreen](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/dellgreen/32/85_2.png) [@dellgreen](https://hub.mender.io/u/dellgreen)\
**Post date:** [May 21, 2020, 8:28am UTC](https://hub.mender.io/t/mender-server-start-at-boot/1931/4 "2020-05-21T08:28:18Z")

</div>

I think i changed the restart policy on each of the mender containers from “always” to “no” to stop the containers starting on boot. The following command will reconfigure each of your running containers

`docker update --restart=no $(docker ps -a -q)`

> **[Start containers automatically](https://docs.docker.com/config/containers/start-containers-automatically/)**
>
> How to start containers automatically
