---
slug: /quickstart/593914/hello
displayed_sidebar: "quickstart"
hide_table_of_contents: true
title: "Write your first Dagger pipeline"
---

# Quickstart

import Tabs from "@theme/Tabs";
import TabItem from "@theme/TabItem";
import QuickstartDoc from '@site/src/components/quickstartDoc.js'
import Embed from '@site/src/components/embed.js'

export const ids = {
    Go: "AqF1QrJBh1L",
    "Node.js": "ANSxtgC136o",
    Python: "sLUm92wLwtw"
}

<QuickstartDoc embeds={ids}>

## Write your first Dagger pipeline

You're now ready to dive into Dagger and write your first pipeline!

This first example is fairly simple: it creates a Dagger client using your chosen SDK, initializes a container, executes a command in that container and prints the output.

<Tabs groupId="language" className="embeds">
<TabItem value="Go">

In the `ci` directory, create a file named `main.go` and add the following code to it.

<Embed id="AqF1QrJBh1L"/>

This Go program imports the Dagger SDK and defines a `main()` function for the pipeline operations. This function performs the following operations:

- It creates a Dagger client with `dagger.Connect()`. This client provides an interface for executing commands against the Dagger Engine.
- It uses the client's `Container().From()` method to initialize a new container from a base image. In this example, the base image is `golang:1.19`. This method returns a `Container` representing an OCI-compatible container image.
- It uses the `Container.WithExec()` method to define the command to be executed in the container - in this case, the command `go version`, which returns the Go version string. The `WithExec()` method returns a revised `Container` with the results of command execution.
- It retrieves the output stream of the last executed with the `Container.Stdout()` method and prints the result to the console.

Run the pipeline by executing the command below from the application directory:

```shell
dagger run go run ci/main.go
```

Dagger performs the operations defined in the pipeline script, logging each operation to the console. Once the pipeline is resolved, it outputs a string similar to the one below.

```shell
Hello from Dagger and go version go1.19.5 linux/amd64
```

</TabItem>
<TabItem value="Node.js">

In the `ci` directory, create a new file named `index.mjs` and add the following code to it.

<Embed id="ANSxtgC136o"/>

This Node.js script imports the Dagger SDK and defines an asynchronous function. This function performs the following operations:

- It creates a Dagger client with `connect()`. This client provides an interface for executing commands against the Dagger Engine.
- It uses the client's `container().from()` method to initialize a new container from a base image. In this example, the base image is `node:16-slim`. This method returns a `Container` representing an OCI-compatible container image.
- It uses the `Container.withExec()` method to define the command to be executed in the container - in this case, the command `node -v`, which returns the Node version string. The `withExec()` method returns a revised `Container` with the results of command execution.
- It retrieves the output stream of the last executed with the `Container.stdout()` method and prints the result to the console.

Run the pipeline by executing the command below from the application directory:

```shell
dagger run node ci/index.mjs
```

Dagger performs the operations defined in the pipeline script, logging each operation to the console. Once the pipeline is resolved, it outputs a string similar to the one below.

```shell
Hello from Dagger and Node v16.18.1
```

</TabItem>
<TabItem value="Python">

In the `ci` directory, create a new file named `main.py` and add the following code to it.

<Embed id="sLUm92wLwtw"/>

This Python script imports the Dagger SDK and defines an asynchronous function. This function performs the following operations:

- It creates a Dagger client with `with dagger.Connection()`. This client provides an interface for executing commands against the Dagger Engine.
- It uses the client's `container().from_()` method to initialize a new container from a base image. In this example, the base image is `python:3.11-slim`. This method returns a `Container` representing an OCI-compatible container image.
- It uses the `Container.with_exec()` method to define the command to be executed in the container - in this case, the command `python -V`, which returns the Python version string. The `with_exec()` method returns a revised `Container` with the results of command execution.
- It retrieves the output stream of the last executed with the `Container.stdout()` method and prints the result to the console.

Run the pipeline by executing the command below from the application directory:

```shell
dagger run python ci/main.py
```

Dagger performs the operations defined in the pipeline script, logging each operation to the console. Once the pipeline is resolved, it outputs a string similar to the one below.

```shell
Hello from Dagger and Python v3.11.1
```

</TabItem>
</Tabs>

Well done! You've just successfully written and run your first Dagger pipeline!

</QuickstartDoc>
