Ubuntu deepstack docker autostart

Hi,
installed deepstack docker with Nvidia grid GPU on ubuntu 20.04 vm on esxi.
Rigth now I ssh into the vm and start deepstack with docker run.
That seems to be working fine. My impression is it’s more stable than DS Windows GPU…

How would I go about autostarting my docker run on ubuntu boot/restart and keep it running even if no one is logged in?

Would this be the right way?

sudo systemctl enable docker.service
sudo systemctl enable containerd.service
sudo docker run --restart=always --runtime=nvidia --gpus all -e API-KEY= -e ADMIN-KEY= -e VISION-SCENE=True -e VISION-DETECTION=True -v localstorage:/datastore -p 80:5000 deepquestai/deepstack:gpu

cheers
Chris

1 Like

@busch09 I don’t think you need to restart the Docker service. What you can do is

  • The first time you run DeepStack, give the container a name
    e.g
sudo docker run --name deepstack --restart=always --runtime=nvidia --gpus all -e API-KEY= -e ADMIN-KEY= -e VISION-SCENE=True -e VISION-DETECTION=True -v localstorage:/datastore -p 80:5000 deepquestai/deepstack:gpu
  • Then when you restart Ubuntu, run the commands below
sudo docker rm -f deepstack
sudo docker run --name deepstack --restart=always --runtime=nvidia --gpus all -e API-KEY= -e ADMIN-KEY= -e VISION-SCENE=True -e VISION-DETECTION=True -v localstorage:/datastore -p 80:5000 deepquestai/deepstack:gpu

That should do it.

Thank you, my point was that I do not want to run any commands when I restart ubuntu.
How would I go about doing that ?

1 Like

In that case, this might come handy.

Add the -d flag along with the --restart=always flag in the docker run command. This will keep the container running as a daemon, and auto start it with the OS.