cmennens@deb-1:~/terraform/postgres$ terraform -version
Terraform v1.1.4
on linux_amd64
+ provider registry.terraform.io/kreuzwerker/docker v2.13.0
I am trying to learn terraform and I was using the official guide where they show you how to create a really quick and simple Nginx container using the following main.tf example:
terraform {
required_providers {
docker = {
source = "kreuzwerker/docker"
version = "~> 2.13.0"
}
}
}
provider "docker" {}
resource "docker_image" "nginx" {
name = "nginx:latest"
keep_locally = false
}
resource "docker_container" "nginx" {
image = docker_image.nginx.latest
name = "tutorial"
ports {
internal = 80
external = 8000
}
}
The above example works fine. Creates the container no problem.
When I attempt to deploy a postgres container using the the same example template above but changing every occurrence of “nginx” to “postgres”, it fails with:
│ Error: Unable to create container with image docker_image.postgres: unable to pull image docker_image.postgres: error pulling image docker_image.postgres: Error response from daemon: pull access denied for docker_image.postgres, repository does not exist or may require 'docker login': denied: requested access to the resource is denied
│
│ with docker_container.postgres,
│ on main.tf line 17, in resource "docker_container" "postgres":
│ 17: resource "docker_container" "postgres" {