This message was deleted.
# general
s
This message was deleted.
l
Can you describe the problem(s) you run into?
@dazzling-sundown-39670?
d
@limited-rainbow-51650 I'm doing the following:
const registry = new digitalocean.ContainerRegistry('microservices')
But I'm not sure how to use it:
Copy code
const testImage = new docker.Image('microservices', {
  build: '../microservices',
  imageName: 'microservices',
  registry: ???
})
l
Have you created a registry at Digital Ocean already? https://www.digitalocean.com/docs/images/container-registry/quickstart/
d
@limited-rainbow-51650 I was hoping to do it with
new digitalocean.ContainerRegistry
I can see it getting created, but let me doublecheck
l
on the
registry
resource, you have the
endpoint
as well as
serverUrl
outputs. I guess you have to use one of these as the
registry
for the
testImage
resource.
d
I think my problem is that
credentials
doesn't contain the key
dockerCredentials
l
You mean the push of the image fails?
d
@limited-rainbow-51650 I came a bit further and that seems like it
This is my full example now:
Copy code
const registry = new digitalocean.ContainerRegistry('microservices-test');

export const credentials = new digitalocean.ContainerRegistryDockerCredentials(
  'microservices',
  {
    registryName: registry.name,
    write: true,
    expirySeconds: 60 * 60 * 365 * 49, // 49 years
  },
);

export const dockerRegistryCredentials = credentials.dockerCredentials.apply(
  (credentials) => {
    const json = JSON.parse(credentials);
    const base64 = json.auths['<http://registry.digitalocean.com|registry.digitalocean.com>'].auth;
    const [username, password] = atob(base64).split(':');
    return {
      username,
      password,
      server: '<http://registry.digitalocean.com|registry.digitalocean.com>',
    };
  },
);

export const testImage = new docker.Image('microservices', {
  build: '../microservices',
  imageName: 'microservices',
  registry: dockerRegistryCredentials,
});
error: denied: requested access to the resource is denied
I guess this is the problem:
The push refers to repository [<http://docker.io/library/microservices|docker.io/library/microservices>]
l
Update your
imageName
to the format
Copy code
<http://registry.digitalocean.com/<my-registry>/<my-image|registry.digitalocean.com/<my-registry>/<my-image>>
like you would if you used plain
docker push
It is eventually
docker push
under the hood
d
Cheers, I'll try it out 👍
thanks 🙏 seems to be working now
🎉 1