# 403 Error when trying to create virtual machine

**URL:** https://forum.codewithmosh.com/t/403-error-when-trying-to-create-virtual-machine/24207
**Category:** Docker
**Created:** [December 21, 2023, 12:31pm UTC](https://forum.codewithmosh.com/t/403-error-when-trying-to-create-virtual-machine/24207 "2023-12-21T12:31:25Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![LucasO](https://avatars.discourse-cdn.com/v4/letter/l/8baadc/32.png) [@LucasO](https://forum.codewithmosh.com/u/LucasO)
#### Post date: [December 21, 2023, 12:31pm UTC](https://forum.codewithmosh.com/t/403-error-when-trying-to-create-virtual-machine/24207/1 "2023-12-21T12:31:25Z")

</div>

Hello. I’m currently in the Deployment section of The Ultimate Docker Course and running into an error when I run -

```auto
docker-machine create \
  --driver digitalocean \
  --digitalocean-access-token "MY_TOKEN_KEY" \
  --engine-install-url "https://releases.rancher.com/install-docker/19.03.9.sh" \
  vidly

```

I’m getting the following error (see last line) -

```auto
Running pre-create checks...
Creating machine...
(vidly) Creating SSH key...
Error creating machine: Error in driver during machine creation: POST https://api.digitalocean.com/v2/account/keys: 403 You are not authorized to perform this operation

```

Any suggestions on how to debug this would be appreciated.

Thanks!

---

<div class="post-metadata">

### Author: ![LucasO](https://avatars.discourse-cdn.com/v4/letter/l/8baadc/32.png) [@LucasO](https://forum.codewithmosh.com/u/LucasO)
#### Post date: [December 21, 2023, 12:50pm UTC](https://forum.codewithmosh.com/t/403-error-when-trying-to-create-virtual-machine/24207/2 "2023-12-21T12:50:24Z")

</div>

**Update!**

Fixed the `403` error by editing my [token](https://cloud.digitalocean.com/account/api/tokens) to be `read` and `write`. It was set to `read` only.

Next I this command again -

```auto
docker-machine create \
  --driver digitalocean \
  --digitalocean-access-token "MY_TOKEN_KEY" \
  --engine-install-url "https://releases.rancher.com/install-docker/19.03.9.sh" \
  vidly

```

This time I received a `402` error -

```auto
Error creating machine: Error in driver during machine creation: POST https://api.digitalocean.com/v2/droplets: 422 You specified an invalid image for Droplet creation.

```

I fixed this by following the instructions [here](https://forum.codewithmosh.com/t/docker-machine-create-error-creating-machine-error-in-driver-during-machine-creation-post-https-api-digitalocean-com-v2-droplets-422-image-is-not-available/6373). So I ran this command again specifying the ubuntu image -

```docker-machine
  --driver digitalocean \
  --digitalocean-access-token "MY_TOKEN_KEY" \
  --digitalocean-image "ubuntu-20-04-x64" \
  --engine-install-url "https://releases.rancher.com/install-docker/19.03.9.sh" \
  vidly

```

It appeared to be creating the docker machine, but now I get a new error (see last line) -

```auto
Running pre-create checks...
Creating machine...
(vidly) Creating SSH key...
(vidly) Creating Digital Ocean droplet...
(vidly) Waiting for IP address to be assigned to the Droplet...
Waiting for machine to be running, this may take a few minutes...
Detecting operating system of created instance...
Waiting for SSH to be available...
Detecting the provisioner...
Provisioning with ubuntu(systemd)...
Installing Docker...
Error creating machine: Error running provisioning: error installing docker: 

```

Again any help will be appreciated.

Thanks!
