question

dunnp avatar image
dunnp asked

How to start Docker Victron containers automatically?

I have successfully installed Docker Desktop and Grafana on a Windows PC and have the Victron dashboard working nicely - but still tweaking. Layout below for interest.

Now I'm trying to streamline things.

I created a desktop shortcut to the Grafana dashboard. That works fine - but only if the Docker containers are running first.

At boot-up, Docker loads and runs in the background but to get the Grafana dashboard going, I have to jump into the (hidden) Docker Desktop dashboard and manually click the Start button for the Victron containers each time I start the laptop.

I can't find anywhere in the Docker Desktop to auto-start containers. Can anyone point me in the right direction?

Cheers

Phil

grafana
1591656287100.png (222.7 KiB)
2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

9 Answers
paulcandelaria avatar image
paulcandelaria answered ·

You can automatically start containers by adding the "restart" option in the docker-compose.yaml file. In this way Docker takes care of restarting the containers as opposed to an OS dependent solution. I have configured the "restart" option for each of my containers in my file, see example below (deployed on a Raspberry PI):

graphing:

container_name: grafana

restart: unless-stopped

image: "victronenergy/venus-docker-grafana:2.0.0"

However, you could also use the following options depending on your requirements:


restart: "no"restart: alwaysrestart: on-failurerestart: unless-stopped
https://docs.docker.com/compose/compose-file/#restart


2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

ajm avatar image
ajm answered ·

Hi Guys

Below docker compose setting will auto start the images.



1597224514275.png (21.7 KiB)
1 comment
2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

dunnp avatar image dunnp commented ·

Brilliant - exactly what I need. Works a treat now on my Windows machines.

Thanks.

Phil

0 Likes 0 ·
Scott Bender avatar image
Scott Bender answered ·

It doesn't look like there currently any way to do this. You would need to use an OS specific method of running the docker-compose command at boot up. What OS are you using?

1 comment
2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

dunnp avatar image dunnp commented ·

Using Windows 10 Home with Windows Insider added - effectively W10 Pro from what I can gather.

0 Likes 0 ·
ianp avatar image
ianp answered ·

Thanks for the great tip Scott. I have just found the same issue with a Raspberry PI 3 installation. The following worked for me:

Add the following to /etc/rc.local before the exit 0.


# Start the Victron influx Grafana package on every boot

cd /home/pi/Downloads

docker-compose up --detach



/home/pi/Downloads is where I saved docker-compose.yaml

I am setting up a remote Victron system with no internet access. Have Venus runing on a Raspberry PI 3, and a second RPI with docker influx and grafana. It’s looking very good.


Ian

2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

Rene Mullie avatar image
Rene Mullie answered ·

This is a functionality which is desirable in almost every setup i guess, might be a good idea to point this out to the Victron moderator to include this in the video/github manual. It took me quite some time to figure it out as I had no experience with Docker at the time.

2 comments
2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

dunnp avatar image dunnp commented ·

Agree - should be part of the docker-compose.yaml file as standard.

0 Likes 0 ·
markus avatar image markus ♦♦ dunnp commented ·

I have just forwarded this to the developers. Thanks!

0 Likes 0 ·
elvis avatar image
elvis answered ·

Still relevant and helped me today.

Thanks

2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

Ulrich avatar image
Ulrich answered ·

At first I also worked with Docker. Now I have installed all services directly on Windows. For me, this has the advantage that it is easier to administer and that I can update all components myself.

- Influx DB is available for Windows
- Grafana is available for Windows
- I can also help with the implementation of the VRM connection


My Grafana Dashboard: https://www.zoomsoft.de/grafana


2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

elvis avatar image
elvis answered ·

@Ulrich

Indeed, can you assist in setting up a stand alone local database (no vrm, cerbo gx only)? I am currently running the docker version but would like to be able to run without docker and be able update grafana and or influxdb to the latest versions.

1 comment
2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

Ulrich avatar image Ulrich commented ·

Ok, i will open a new thread and fill it step by step up with installation instructions.

0 Likes 0 ·
sebashb avatar image
sebashb answered ·

@Ulrich

I'm also trying to run the Victron's Venus Node.js server without docker, as a standalone server, but I'm not having much success. I tried to build the server from this source with

npm install && npm run build

using Node.js 8 but, although there are no errors, when I lunch the server with

npm run start-web

the interface is not completed and most of it is missing.

captura-de-ecra-2022-01-30-as-230854.png


The only tab that shows the right interface is the security tab. Did you succeed in building and running the server from source?

(If I run the docker container everything shows up correctly)


2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.