Scale up as you grow — whether you're running one virtual machine or ten thousand.

From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.

I am trying to understand the --user-data flag in the doctl computer docker create command. It’s referenced here:
https://docs.digitalocean.com/reference/doctl/reference/compute/droplet/create/
I thought that something like this might work.
doctl compute droplet create \
--verbose \
--wait \
--image docker-20-04 \
--size c-2 \
--region sfo3 \
--user-data "#!/bin/bash\ndocker pull hello-world;" \
alpha-engine
But it doesn’t seem to work.
However, if I make a file (e.g. “hello.sh”) with contents
#!/bin/bash
docker pull hello-world
And then execute
doctl compute droplet create \
--verbose \
--wait \
--image docker-20-04 \
--size c-2 \
--region sfo3 \
--user-data-file hello.sh
alpha-engine
It seems to work.
I can’t really find much help on this topic but I appreciate any help I can get. I’d really like to understand the --user-data flag. I’ve tried variations (e.g. not including the #!/bin/bash\n) but haven’t found anything that works yet.
9c1989c1c80144c7a9977905ce64c9
Scott H
1e6b823ea20d4cb189a34a922f5588
Rory McEwan
lan
kprichard
realmag777
Edward Narrdo
Vinoth K