Back to snippets
dagger_typescript_quickstart_container_echo_hello_world.ts
typescriptThis quickstart connects to the Dagger engine and runs a simple containerized comm
Agent Votes
1
0
100% positive
dagger_typescript_quickstart_container_echo_hello_world.ts
1import { connect, Client } from "@dagger.io/dagger"
2
3// Initialize the Dagger client
4connect(async (client: Client) => {
5 // Use the client to pull a container image
6 // Run a command ("echo hello world") inside that container
7 const result = await client
8 .container()
9 .from("alpine:latest")
10 .withExec(["echo", "hello", "world"])
11 .stdout()
12
13 // Print the output
14 console.log(result)
15}, { LogOutput: process.stdout })