Hi, I'm new to using the app and I was wondering i...
# rancher-desktop
f
Hi, I'm new to using the app and I was wondering if there was a way to create a script that can start a docker container (with
docker-compose up -d
) on startup ? I've tried using provisioning scripts but end up getting stuck waiting for docker to be ready as the startup doesn't start Docker until the provisioning scripts have finished...
f
Can't you just use the
restart
policy in the compose file to achieve this? Something like
Copy code
services:
  your_service:
    image: your_image
    restart: unless-stopped
f
I'm not sure this would work in my case. The point of this is to be able to load a prebuilt image on the machine and then with a single click open Rancher-Desktop, start the containers, and start a localhost page.
f
I think all of this should work, except for opening a page in the host browser. That isn't possible from inside the VM; you would have to do this from a wrapper script. Something like (assuming macOS):
Copy code
rdctl start
while ! curl -s 127.0.0.1:3000 >/dev/null; do sleep 1; done
open <http://127.0.0.1:3000>