Skip to content

Instantly share code, notes, and snippets.

@socheatsok78
Last active March 15, 2023 08:46
Show Gist options
  • Save socheatsok78/784f5ff06f512b2ca07ad82b9786120e to your computer and use it in GitHub Desktop.
Save socheatsok78/784f5ff06f512b2ca07ad82b9786120e to your computer and use it in GitHub Desktop.
Deploy Portainer Droplet on Digital Ocean

Portainer Droplet on Digital Ocean:

  1. In the Digital Ocean portal, go to the project view.
  2. Click New Droplet.
  3. Click Create Droplet.
  4. Click the Marketplace tab.
  5. Click Docker.
  6. Choose a plan. Make sure your Droplet has the minimum hardware requirements for Docker.
  7. Choose any options for backups, block storage, and datacenter region.
  8. Optional: In the Select additional options section, you can check the User data box and enter a cloud-config file in the text box that appears. The cloud-config file is used to provide a script to be run on the first boot. An example is below.
  9. Choose an SSH key that you have access to, or generate a new SSH key.
  10. Choose your project.
  11. Click Create.

Below is an example cloud-config file that you can use to initialize the Droplet with user data, such as deploying Waypoint:

If you don't have an Digital Ocean account, click here to create an account you will get $100 for you to spend on your first server.

#!/bin/bash
curl https://raw.githubusercontent.com/socheatsok78/wait-for-docker/master/install.sh | /bin/bash -s
wait-for-docker
docker pull portainer/portainer-ce
docker volume create portainer_data
docker run -d \
-p 8000:8000 \
-p 9000:9000 \
--name=portainer \
--restart=always \
-v /var/run/docker.sock:/var/run/docker.sock \
-v portainer_data:/data \
portainer/portainer-ce
echo "\nPortainer is ready on port 9000"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment