The following is a simple instructional for configuring your Windows 10 machine running Docker to auto-start the VideoCoin Worker during boot (startup). This tutorial assumes that you’ve already configured Docker to startup automatically.
Create a simple batch file to enable Docker and the Worker process. To do this open Notepad, or equivalent text editor, and input the following four lines:
docker run --rm --env-file vars.env videocoinnetwork/worker:latest
(Note: the above assumes that your vars.env file is located in the same directory that you are running the docker as noted in the ‘cd’ command. Simply change the directory structure above to match the location of where you stored your vars.env file and where you intend to run docker from. For me I stored my vars.env in the C:\Users\Santiago\VideoCoin directory, so that is where I navigate the command prompt to before running the Docker command)
- Save the file as VCWorkerStart.bat. Make sure the file extension is .bat and NOT .txt. You can verify this by changing your Windows File Explorer Options and disabling the ‘Hide extensions for known file types’, which can be found under the ‘View’ tab File Explorer Options.
- We now need to add a startup process and a slight delay to that process in order to allow the Docker for Windows processes to auto-start before the batch file runs, otherwise you will get an error. We will use Windows Task Scheduler to achieve this. Open the Task Scheduler by searching for it in the start menu or by using the taskschd.msc from the Run command. It should look like this:
- Select “Create Task” and then name your task. I named mine “Open VCWorkerStart.bat with Delay” and add a description. You can choose how you want to run it (after logon or not). Here’s how I configured mine:
- After naming the task, go to the Triggers tab and click on the ‘New…’ button to create a new trigger. In case you are wondering, a trigger is nothing but an event that does something.
- In the New Trigger window, select ‘At log on’ from the first drop-down menu at the top. Next, check the “Delay Task For” checkbox and select “5 minutes” from the drop-down next to it. Click on the Ok button. This will make sure that the task will only trigger 5 minutes after you log in. You can select any length of time you want from the drop-down menu and you may have to play with this setting to get it just right depending on how many processes you have starting up on your machine before Docker. Here’s what it should look like:
- Now, we need to add the batch process which we want to open at the trigger event. So, go to the Actions tab and click on the New button.
- Select “Start a Program” from the first drop-down menu. Next, click on the Browse button and navigate to the bat file you created above.
You will see the file path added in the Program/Script field. Click on the Ok button to save changes.
Finally, click on the Ok button in the main window to save the task.
- Just to make sure the task runs and opens the application, right-click on the task you just created and select the Run option. It should start the application immediately.
Reboot your machine and verify operation.
From now on each time your machine is started the process will auto-start based on your configuration choices without any other active intervention.
Feel free to reach out with questions!