Repository navigation
Closed
Description
What is the issue?
I am trying to publish a docker image to a local registry to evaluate dagger. After a few tries I can manage to export the container, but I am not able to publish.
The SDK guide should include an example of how to publish an image, rather than just showing how to export the build to the host system.
Steps I have done so far:
- run local registry with
docker run -d -p 5000:5000 --restart=unless-stopped --name registry registry:2 - add
"insecure-registries": ["http://localhost:5000"]to/etc/docker/daemon.json - use dagger to publish to
localhost:5000
The error message contains "authorization failed", so I trieddocker login localhost:5000. I can push images using docker push localhost:5000 without problems.
What am I doing wrong?
// build.ts
import Client, { connect } from "@dagger.io/dagger";
await connect(
async (client: Client) => {
await client.container().from("hello-world").export('./hello-world.tgz');
await client.container().from("hello-world").publish('localhost:5000');
},
{ LogOutput: process.stdout }
);(node:44067) ExperimentalWarning: Custom ESM Loaders is an experimental feature. This feature could change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
#1 resolve image config for docker.io/library/hello-world:latest
#1 DONE 2.0s
#2 docker-image://docker.io/library/hello-world:latest
#2 resolve docker.io/library/hello-world:latest
#2 resolve docker.io/library/hello-world:latest 0.2s done
#2 CACHED
#3 exporting to oci image format
#3 exporting layers done
#3 exporting manifest sha256:527f201ea8b5e93034cbbdd33e94d3e112fb52523ada07f3c9641dbfdb3fc228 0.0s done
#3 exporting config sha256:f5adce0eef760a932ed6bd40c1b4c021bcceac28d92f19fb13b17f8fe504e9f2
#3 exporting config sha256:f5adce0eef760a932ed6bd40c1b4c021bcceac28d92f19fb13b17f8fe504e9f2 0.0s done
#3 sending tarball done
#3 DONE 0.1s
#1 resolve image config for docker.io/library/hello-world:latest
#1 DONE 2.3s
#2 docker-image://docker.io/library/hello-world:latest
#2 resolve docker.io/library/hello-world:latest 0.2s done
#2 DONE 0.5s
#2 docker-image://docker.io/library/hello-world:latest
#2 CACHED
#4 exporting to image
#4 exporting layers done
#4 exporting manifest sha256:b0ae4cb23f8af327bf924d56b231a94580289f50c32393a8c276735798002dba 0.0s done
#4 exporting config sha256:f5adce0eef760a932ed6bd40c1b4c021bcceac28d92f19fb13b17f8fe504e9f2 done
#4 pushing layers
#4 pushing layers 1.0s done
#4 ERROR: server message: insufficient_scope: authorization failed
------
> exporting to image:
------
/home/sengmann/Projekte/private/dagger-test/node_modules/graphql-request/dist/index.js:63
op = body.call(thisArg, _);
^
ClientError: failed to solve: server message: insufficient_scope: authorization failed: {"response":{"data":null,"errors":[{"message":"failed to solve: server message: insufficient_scope: authorization failed","locations":[{"line":7,"column":9}],"path":["container","from","publish"]}],"status":200,"headers":{}},"request":{"query":"\n {\n container {\n \n from (address: \"hello-world\") {\n \n publish (address: \"localhost:5000\") }}\n }\n "}}
at /home/sengmann/Projekte/private/dagger-test/node_modules/graphql-request/src/index.ts:497:11
at step (/home/sengmann/Projekte/private/dagger-test/node_modules/graphql-request/dist/index.js:63:23)
at Object.next (/home/sengmann/Projekte/private/dagger-test/node_modules/graphql-request/dist/index.js:44:53)
at fulfilled (/home/sengmann/Projekte/private/dagger-test/node_modules/graphql-request/dist/index.js:35:58)
at processTicksAndRejections (node:internal/process/task_queues:95:5) {
response: {
data: null,
errors: [ [Object] ],
status: 200,
headers: Headers { [Symbol(map)]: [Object: null prototype] }
},
request: {
query: '\n' +
' {\n' +
' container {\n' +
' \n' +
' from (address: "hello-world") {\n' +
' \n' +
' publish (address: "localhost:5000") }}\n' +
' }\n' +
' ',
variables: undefined
}
}Metadata
Metadata
Assignees
Labels
No labels
Activity
dolanor commentedon Dec 6, 2022
There are a few problems in this report for me to reproduce.
localhost:5000. I would think you need to point to your real IP address, otherwise, it would point to the dagger container's localhost address instead.xx.yy.zz.ww:5000/my/hello-world:latestfor example.But then, you will probably hit: https://discord.com/channels/707636530424053791/1046817210695417906/1046817210695417906 which might be some error in buildkit (tracked here)
One way to fix it for now would be to actually generate correct TLS certificate until we figure that out.
So the fix for now:
I tried on the Docker Hub, it worked:
https://hub.docker.com/repository/docker/dolanor/hello-world-dagger
sengmann commentedon Dec 7, 2022
@dolanor Thanks for your feedback. I will try your suggestion. The documentation of the Container.publish method should be more specific about the address parameter.
dolanor commentedon Dec 12, 2022
I totally agree with you, we're gonna fix it very soon.
sengmann commentedon Dec 13, 2022
@dolanor With the help of your example I was able to fix the problem. Thanks again.