<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Run a test with extensions on Grafana Labs</title><link>https://grafana.com/docs/k6/v2.3.x/extensions/run/</link><description>Recent content in Run a test with extensions on Grafana Labs</description><generator>Hugo -- gohugo.io</generator><language>en</language><atom:link href="/docs/k6/v2.3.x/extensions/run/index.xml" rel="self" type="application/rss+xml"/><item><title>Build a k6 binary using Go</title><link>https://grafana.com/docs/k6/v2.3.x/extensions/run/build-k6-binary-using-go/</link><pubDate>Mon, 21 Sep 2026 15:16:28 +0000</pubDate><guid>https://grafana.com/docs/k6/v2.3.x/extensions/run/build-k6-binary-using-go/</guid><content><![CDATA[&lt;h1 id=&#34;build-a-k6-binary-using-go&#34;&gt;Build a k6 binary using Go&lt;/h1&gt;
&lt;p&gt;To use an extension that you found on the 
    &lt;a href=&#34;/docs/k6/v2.3.x/extensions/explore/&#34;&gt;Extension page&lt;/a&gt; or the &lt;a href=&#34;https://github.com/topics/xk6&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;xk6 GitHub topic&lt;/a&gt;,
you need to build a binary using Go.&lt;/p&gt;


&lt;div class=&#34;admonition admonition-note&#34;&gt;&lt;blockquote&gt;&lt;p class=&#34;title text-uppercase&#34;&gt;Note&lt;/p&gt;&lt;p&gt;Not interested in setting up a Go environment? You can 
    &lt;a href=&#34;/docs/k6/v2.3.x/extensions/build-k6-binary-using-docker/&#34;&gt;use Docker instead&lt;/a&gt;.&lt;/p&gt;&lt;/blockquote&gt;&lt;/div&gt;

&lt;h2 id=&#34;before-you-start&#34;&gt;Before you start&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Set up &lt;a href=&#34;https://golang.org/doc/install&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Go&lt;/a&gt; and &lt;a href=&#34;https://git-scm.com/&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Git&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Make sure that your &lt;code&gt;$PATH&lt;/code&gt; environment variable is updated so that &lt;code&gt;go version&lt;/code&gt; returns the correct version.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;installing-xk6&#34;&gt;Installing xk6&lt;/h2&gt;
&lt;p&gt;Given the prerequisite Go setup, installing &lt;a href=&#34;https://github.com/grafana/xk6&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;xk6&lt;/a&gt; itself requires only the following command:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;go install go.k6.io/xk6/cmd/xk6@latest&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;To confirm your installation, run &lt;code&gt;which xk6&lt;/code&gt; on Linux and Mac, or &lt;code&gt;where xk6&lt;/code&gt; on Windows.
Make sure the command returns a valid path.&lt;/p&gt;
&lt;p&gt;If not, check that you&amp;rsquo;ve correctly defined the&lt;code&gt;$GOPATH&lt;/code&gt; environment variable and that &lt;code&gt;$GOPATH/bin&lt;/code&gt;
is in your &lt;code&gt;$PATH&lt;/code&gt;. See the &lt;a href=&#34;https://golang.org/cmd/go/#hdr-GOPATH_environment_variable&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Go documentation&lt;/a&gt;
for details.&lt;/p&gt;
&lt;h2 id=&#34;building-your-first-extension&#34;&gt;Building your first extension&lt;/h2&gt;
&lt;p&gt;Once installed, building a k6 binary with one or more extensions can be done with the &lt;code&gt;xk6 build&lt;/code&gt;
command as follows:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;xk6 build latest \
  --with github.com/grafana/xk6-sql@v0.0.1 \
  --with github.com/grafana/xk6-output-prometheus-remote&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Once completed, the &lt;strong&gt;current directory&lt;/strong&gt; contains your newly built &lt;code&gt;k6&lt;/code&gt; binary with
the &lt;a href=&#34;https://github.com/grafana/xk6-sql&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;&lt;code&gt;xk6-sql&lt;/code&gt;&lt;/a&gt; and &lt;a href=&#34;https://github.com/grafana/xk6-output-prometheus-remote&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;&lt;code&gt;xk6-output-prometheus-remote&lt;/code&gt;&lt;/a&gt;
extensions.&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;... [INFO] Build environment ready
... [INFO] Building k6
... [INFO] Build complete: ./k6

xk6 has now produced a new k6 binary which may be different than the command on your system path!
Be sure to run &amp;#39;./k6 run &amp;lt;SCRIPT_NAME&amp;gt;&amp;#39; from the &amp;#39;...&amp;#39; directory.&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h2 id=&#34;breaking-down-the-xk6-command&#34;&gt;Breaking down the xk6 command&lt;/h2&gt;
&lt;p&gt;From the &lt;a href=&#34;https://github.com/grafana/xk6/#command-usage&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;xk6 documentation&lt;/a&gt;, the command-line usage is as follows:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;plain&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-plain&#34;&gt;xk6 build [&amp;lt;k6_version&amp;gt;]
    [--output &amp;lt;file&amp;gt;]
    [--with &amp;lt;module[@version][=replacement]&amp;gt;...]
    [--replace &amp;lt;module=replacement&amp;gt;...]

Flags:
  --output   specifies the new binary name [default: &amp;#39;k6&amp;#39;]
  --replace  enables override of dependencies for k6 and extensions [default: none]
  --with     the extension module to be included in the binary [default: none]&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;blockquote&gt;
&lt;p&gt;The use of &lt;code&gt;--replace&lt;/code&gt; should be considered an advanced feature to be avoided unless required.&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;Referring back to our executed command, note that:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;We specify the version as &lt;code&gt;latest&lt;/code&gt;, which is also the default if we hadn&amp;rsquo;t supplied
a version. &lt;code&gt;latest&lt;/code&gt; means that we&amp;rsquo;ll build using the &lt;em&gt;latest&lt;/em&gt; source code for k6. Consider using
a stable &lt;a href=&#34;https://github.com/grafana/k6/releases&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;release version&lt;/a&gt; as a best practice unless
you genuinely want the &lt;em&gt;bleeding edge&lt;/em&gt;.&lt;/li&gt;
&lt;li&gt;With each &lt;code&gt;--with&lt;/code&gt;, we specified a full GitHub URI for the extension repository. If not specifying
a version, the default is &lt;code&gt;latest&lt;/code&gt; once again. Check your extension repository for stable
release versions, if available, to lock in your version as we&amp;rsquo;ve done with &lt;code&gt;xk6-sql@v0.0.1&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;We did not use the &lt;code&gt;--output&lt;/code&gt; option; therefore, our new binary is &lt;code&gt;k6&lt;/code&gt; within the current directory.
Had we used &lt;code&gt;--output k6-extended&lt;/code&gt;, our binary would be named &lt;code&gt;k6-extended&lt;/code&gt; within the current
directory. If a directory is specified, then the new binary would be &lt;code&gt;k6&lt;/code&gt; within
&lt;em&gt;that&lt;/em&gt; directory. If a path to a non-existent file, e.g. &lt;code&gt;/tmp/k6-extended&lt;/code&gt;, this will be the
path and filename for the binary.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Running &lt;code&gt;./k6 version&lt;/code&gt; should show your build is based upon the appropriate version.&lt;/p&gt;
&lt;h2 id=&#34;building-from-a-local-repository&#34;&gt;Building from a local repository&lt;/h2&gt;
&lt;p&gt;Suppose now you&amp;rsquo;ve cloned the &lt;code&gt;xk6-sql&lt;/code&gt; repository and want the local version included in your
custom binary? From the cloned directory, we would then use:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;--with github.com/grafana/xk6-sql=.&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Based upon the command usage described in the previous section, this tells xk6 to use
the &lt;em&gt;current directory&lt;/em&gt; as the &lt;em&gt;replacement&lt;/em&gt; for the &lt;em&gt;module&lt;/em&gt;.&lt;/p&gt;
&lt;h2 id=&#34;running-your-extended-binary&#34;&gt;Running your extended binary&lt;/h2&gt;
&lt;p&gt;Now that we have our newly built k6 binary, we can run scripts using the functionalities
of the bundled extensions.&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;./k6 run my-script.js&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;blockquote&gt;
&lt;p&gt;Be sure to specify the binary just built in the current directory as &lt;code&gt;./k6&lt;/code&gt;, or else
Linux/Mac could execute another k6 binary on your system path. Windows shells will
first search for the binary in the current directory by default.&lt;/p&gt;&lt;/blockquote&gt;
&lt;!-- TODO: Is this really necessary here? Preserving for the time being.
&gt; Also note that because of the way xk6 works, vendored dependencies (the `vendor`
directory created by `go mod vendor`) will **not** be taken into account when
building a binary, and you don&#39;t need to commit them to the extension repository.
--&gt;
]]></content><description>&lt;h1 id="build-a-k6-binary-using-go">Build a k6 binary using Go&lt;/h1>
&lt;p>To use an extension that you found on the
&lt;a href="/docs/k6/v2.3.x/extensions/explore/">Extension page&lt;/a> or the &lt;a href="https://github.com/topics/xk6" target="_blank" rel="noopener noreferrer">xk6 GitHub topic&lt;/a>,
you need to build a binary using Go.&lt;/p></description></item><item><title>Build a k6 binary using Docker</title><link>https://grafana.com/docs/k6/v2.3.x/extensions/run/build-k6-binary-using-docker/</link><pubDate>Mon, 21 Sep 2026 15:16:28 +0000</pubDate><guid>https://grafana.com/docs/k6/v2.3.x/extensions/run/build-k6-binary-using-docker/</guid><content><![CDATA[&lt;h1 id=&#34;build-a-k6-binary-using-docker&#34;&gt;Build a k6 binary using Docker&lt;/h1&gt;
&lt;p&gt;Using the &lt;a href=&#34;https://hub.docker.com/r/grafana/xk6/&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;xk6 Docker image&lt;/a&gt; can simplify the process of creating a custom k6 binary. It avoids having to setup a local Go environment, and install xk6 manually.&lt;/p&gt;


&lt;div class=&#34;admonition admonition-note&#34;&gt;&lt;blockquote&gt;&lt;p class=&#34;title text-uppercase&#34;&gt;Note&lt;/p&gt;&lt;p&gt;This tutorial is about creating a custom k6 binary (using Docker). If you want to create a Docker image with a custom k6 binary, refer instead to 
    &lt;a href=&#34;/docs/k6/v2.3.x/using-k6/modules/#using-modules-with-docker&#34;&gt;Using modules with Docker&lt;/a&gt;.&lt;/p&gt;&lt;/blockquote&gt;&lt;/div&gt;

&lt;h2 id=&#34;building-your-first-extension&#34;&gt;Building your first extension&lt;/h2&gt;
&lt;p&gt;For example, to build a custom k6 binary with the latest versions of k6 and the &lt;a href=&#34;https://github.com/mostafa/xk6-kafka&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;&lt;code&gt;xk6-kafka&lt;/code&gt;&lt;/a&gt; and &lt;a href=&#34;https://github.com/grafana/xk6-output-influxdb&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;&lt;code&gt;xk6-output-influxdb&lt;/code&gt;&lt;/a&gt; extensions, run one of the commands below, depending on your operating system:&lt;/p&gt;



  

  

  

  






  

  

  

  



  &lt;div class=&#34;code&#34; x-data=&#34;app_code([&amp;#34;linux&amp;#34;,&amp;#34;mac&amp;#34;,&amp;#34;windows-powershell&amp;#34;,&amp;#34;windows&amp;#34;], false)&#34; x-init=&#34;init()&#34; data-codetoggle=&#34;true&#34;&gt;
    &lt;div class=&#34;toggle-toolbar &#34;&gt;
      &lt;div&gt;&lt;button class=&#34;toggle-toolbar__item&#34; :class=&#34;{ &#39;toggle-toolbar__item-active&#39;: active === &#39;linux&#39; }&#34; @click=&#34;$store.code.language = &#39;linux&#39;&#34;&gt;
              &lt;span&gt;linux&lt;/span&gt;
            &lt;/button&gt;&lt;button class=&#34;toggle-toolbar__item&#34; :class=&#34;{ &#39;toggle-toolbar__item-active&#39;: active === &#39;mac&#39; }&#34; @click=&#34;$store.code.language = &#39;mac&#39;&#34;&gt;
              &lt;span&gt;mac&lt;/span&gt;
            &lt;/button&gt;&lt;button class=&#34;toggle-toolbar__item&#34; :class=&#34;{ &#39;toggle-toolbar__item-active&#39;: active === &#39;windows-powershell&#39; }&#34; @click=&#34;$store.code.language = &#39;windows-powershell&#39;&#34;&gt;
              &lt;span&gt;windows-powershell&lt;/span&gt;
            &lt;/button&gt;&lt;button class=&#34;toggle-toolbar__item&#34; :class=&#34;{ &#39;toggle-toolbar__item-active&#39;: active === &#39;windows&#39; }&#34; @click=&#34;$store.code.language = &#39;windows&#39;&#34;&gt;
              &lt;span&gt;windows&lt;/span&gt;
            &lt;/button&gt;&lt;/div&gt;
      &lt;div class=&#34;d-flex&#34;&gt;&lt;span class=&#34;code-clipboard&#34; x-ref=&#34;tooltip&#34;&gt;
          &lt;button @click=&#34;copy()&#34;&gt;
            &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
            &lt;span&gt;Copy&lt;/span&gt;
          &lt;/button&gt;
        &lt;/span&gt;
      &lt;/div&gt;
      &lt;div class=&#34;toggle-toolbar__border&#34;&gt;&lt;/div&gt;
    &lt;/div&gt;
    
    &lt;div class=&#34;code-rendered&#34; &gt;
      
&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;linux&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-linux&#34;&gt;docker run --rm -u &amp;#34;$(id -u):$(id -g)&amp;#34; -v &amp;#34;${PWD}:/xk6&amp;#34; grafana/xk6 build \
  --with github.com/mostafa/xk6-kafka \
  --with github.com/grafana/xk6-output-influxdb&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;mac&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-mac&#34;&gt;docker run --rm -e GOOS=darwin -u &amp;#34;$(id -u):$(id -g)&amp;#34; -v &amp;#34;${PWD}:/xk6&amp;#34; \
  grafana/xk6 build \
  --with github.com/mostafa/xk6-kafka \
  --with github.com/grafana/xk6-output-influxdb&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;windows-powershell&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-windows-powershell&#34;&gt;docker run --rm -e GOOS=windows -u &amp;#34;$(id -u):$(id -g)&amp;#34; -v &amp;#34;${PWD}:/xk6&amp;#34; `
  grafana/xk6 build --output k6.exe `
  --with github.com/mostafa/xk6-kafka `
  --with github.com/grafana/xk6-output-influxdb&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;windows&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-windows&#34;&gt;docker run --rm -e GOOS=windows -v &amp;#34;%cd%:/xk6&amp;#34; ^
  grafana/xk6 build --output k6.exe ^
  --with github.com/mostafa/xk6-kafka ^
  --with github.com/grafana/xk6-output-influxdb&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;

    &lt;/div&gt;
  &lt;/div&gt;


&lt;p&gt;This creates a &lt;code&gt;k6&lt;/code&gt; (or &lt;code&gt;k6.exe&lt;/code&gt;) binary in the current working directory.&lt;/p&gt;
&lt;p&gt;To build the binary with concrete versions, see the example below (k6 &lt;code&gt;v0.45.1&lt;/code&gt;, xk6-kafka &lt;code&gt;v0.19.1&lt;/code&gt;, and xk6-output-influxdb &lt;code&gt;v0.4.1&lt;/code&gt;):&lt;/p&gt;



  

  

  

  






  

  

  

  



  &lt;div class=&#34;code&#34; x-data=&#34;app_code([&amp;#34;linux&amp;#34;,&amp;#34;mac&amp;#34;,&amp;#34;windows-powershell&amp;#34;,&amp;#34;windows&amp;#34;], false)&#34; x-init=&#34;init()&#34; data-codetoggle=&#34;true&#34;&gt;
    &lt;div class=&#34;toggle-toolbar &#34;&gt;
      &lt;div&gt;&lt;button class=&#34;toggle-toolbar__item&#34; :class=&#34;{ &#39;toggle-toolbar__item-active&#39;: active === &#39;linux&#39; }&#34; @click=&#34;$store.code.language = &#39;linux&#39;&#34;&gt;
              &lt;span&gt;linux&lt;/span&gt;
            &lt;/button&gt;&lt;button class=&#34;toggle-toolbar__item&#34; :class=&#34;{ &#39;toggle-toolbar__item-active&#39;: active === &#39;mac&#39; }&#34; @click=&#34;$store.code.language = &#39;mac&#39;&#34;&gt;
              &lt;span&gt;mac&lt;/span&gt;
            &lt;/button&gt;&lt;button class=&#34;toggle-toolbar__item&#34; :class=&#34;{ &#39;toggle-toolbar__item-active&#39;: active === &#39;windows-powershell&#39; }&#34; @click=&#34;$store.code.language = &#39;windows-powershell&#39;&#34;&gt;
              &lt;span&gt;windows-powershell&lt;/span&gt;
            &lt;/button&gt;&lt;button class=&#34;toggle-toolbar__item&#34; :class=&#34;{ &#39;toggle-toolbar__item-active&#39;: active === &#39;windows&#39; }&#34; @click=&#34;$store.code.language = &#39;windows&#39;&#34;&gt;
              &lt;span&gt;windows&lt;/span&gt;
            &lt;/button&gt;&lt;/div&gt;
      &lt;div class=&#34;d-flex&#34;&gt;&lt;span class=&#34;code-clipboard&#34; x-ref=&#34;tooltip&#34;&gt;
          &lt;button @click=&#34;copy()&#34;&gt;
            &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
            &lt;span&gt;Copy&lt;/span&gt;
          &lt;/button&gt;
        &lt;/span&gt;
      &lt;/div&gt;
      &lt;div class=&#34;toggle-toolbar__border&#34;&gt;&lt;/div&gt;
    &lt;/div&gt;
    
    &lt;div class=&#34;code-rendered&#34; &gt;
      
&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;linux&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-linux&#34;&gt;docker run --rm -u &amp;#34;$(id -u):$(id -g)&amp;#34; -v &amp;#34;${PWD}:/xk6&amp;#34; grafana/xk6 build v0.45.1 \
  --with github.com/mostafa/xk6-kafka@v0.19.1 \
  --with github.com/grafana/xk6-output-influxdb@v0.4.1&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;mac&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-mac&#34;&gt;docker run --rm -e GOOS=darwin -u &amp;#34;$(id -u):$(id -g)&amp;#34; -v &amp;#34;${PWD}:/xk6&amp;#34; \
  grafana/xk6 build v0.45.1 \
  --with github.com/mostafa/xk6-kafka@v0.19.1 \
  --with github.com/grafana/xk6-output-influxdb@v0.4.1&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;windows-powershell&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-windows-powershell&#34;&gt;docker run --rm -e GOOS=windows -u &amp;#34;$(id -u):$(id -g)&amp;#34; -v &amp;#34;${PWD}:/xk6&amp;#34; `
  grafana/xk6 build v0.45.1 --output k6.exe `
  --with github.com/mostafa/xk6-kafka@v0.19.1 `
  --with github.com/grafana/xk6-output-influxdb@v0.4.1&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;windows&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-windows&#34;&gt;docker run --rm -e GOOS=windows -v &amp;#34;%cd%:/xk6&amp;#34; ^
  grafana/xk6 build v0.45.1 --output k6.exe ^
  --with github.com/mostafa/xk6-kafka@v0.19.1 ^
  --with github.com/grafana/xk6-output-influxdb@v0.4.1&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;

    &lt;/div&gt;
  &lt;/div&gt;


&lt;h2 id=&#34;breaking-down-the-command&#34;&gt;Breaking down the command&lt;/h2&gt;
&lt;p&gt;The example command line may look a bit intimidating at first, but let&amp;rsquo;s focus on the first part, which pertains strictly to Docker:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;docker run --rm -u &amp;#34;$(id -u):$(id -g)&amp;#34; -v &amp;#34;${PWD}:/xk6&amp;#34;&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;This tells Docker to run a new container from an image.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;--rm&lt;/code&gt; means the container will be destroyed once your build is completed.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;-u&lt;/code&gt; specifies the user and group IDs of the account on the host machine. This is important for the &lt;code&gt;k6&lt;/code&gt; file to have the same file permissions as the host user.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;-v&lt;/code&gt; is required to mount the current working directory inside the container, so that the &lt;code&gt;k6&lt;/code&gt; binary can be written to it.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;For Windows and Mac, we additionally include the target system as an environment variable:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;-e GOOS=&amp;lt;target os&amp;gt;&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;The remainder is straight from the &lt;a href=&#34;https://github.com/grafana/xk6/#command-usage&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;xk6 documentation&lt;/a&gt;, with the exception that we use the &lt;code&gt;grafana/xk6&lt;/code&gt; &lt;em&gt;image&lt;/em&gt; rather than a local installation of &lt;code&gt;xk6&lt;/code&gt;:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;plain&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-plain&#34;&gt;grafana/xk6 build [&amp;lt;k6_version&amp;gt;]
    [--output &amp;lt;file&amp;gt;]
    [--with &amp;lt;module[@version][=replacement]&amp;gt;...]
    [--replace &amp;lt;module=replacement&amp;gt;...]

Flags:
  --output   specifies the new binary name [default: &amp;#39;k6&amp;#39;]
  --replace  enables override of dependencies for k6 and extensions [default: none]
  --with     the extension module to be included in the binary [default: none]&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;


&lt;div class=&#34;admonition admonition-caution&#34;&gt;&lt;blockquote&gt;&lt;p class=&#34;title text-uppercase&#34;&gt;Caution&lt;/p&gt;&lt;p&gt;The use of &lt;code&gt;--replace&lt;/code&gt; should be considered an advanced feature to be avoided unless required.&lt;/p&gt;&lt;/blockquote&gt;&lt;/div&gt;

&lt;p&gt;Referring back to our executed command, note that:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;We specify the version as &lt;code&gt;v0.43.1&lt;/code&gt;. When you omit the version or specify &lt;code&gt;latest&lt;/code&gt;, you build using the &lt;em&gt;latest&lt;/em&gt; source code for k6.
Consider using a stable &lt;a href=&#34;https://github.com/grafana/k6/releases&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;release version&lt;/a&gt; as a best practice unless you genuinely want the &lt;em&gt;bleeding edge&lt;/em&gt;.&lt;/li&gt;
&lt;li&gt;We specify a full GitHub URI for the extension repository with each &lt;code&gt;--with&lt;/code&gt;.
If a version is not specified, the default is again the &lt;code&gt;latest&lt;/code&gt;.
Check your extension repository for stable release versions, if available, to lock in your version as we&amp;rsquo;ve done with &lt;code&gt;xk6-kafka@v0.17.0&lt;/code&gt; and &lt;code&gt;xk6-output-influxdb@v0.3.0&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;For Windows, we used the &lt;code&gt;--output&lt;/code&gt; option to name our result as &lt;code&gt;k6.exe&lt;/code&gt;; if not specified, our new binary is &lt;code&gt;k6&lt;/code&gt; within the current directory.
If you specify a directory, the new binary will be &lt;code&gt;k6&lt;/code&gt; within &lt;em&gt;that&lt;/em&gt; directory.
If you specify a path to a non-existent file, e.g. &lt;code&gt;/tmp/k6-extended&lt;/code&gt;, this will be the path and filename for the binary.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Run &lt;code&gt;./k6 version&lt;/code&gt; (or &lt;code&gt;k6.exe version&lt;/code&gt;) to check that your build is based on the appropriate &lt;code&gt;k6&lt;/code&gt; version and contains the desired extensions. For example:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;$ ./k6 version
k6 v0.43.1 ((devel), go1.20.1, darwin/amd64)
Extensions:
  github.com/grafana/xk6-output-influxdb v0.3.0, xk6-influxdb [output]
  github.com/mostafa/xk6-kafka v0.17.0, k6/x/kafka [js]&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h2 id=&#34;running-your-extended-binary&#34;&gt;Running your extended binary&lt;/h2&gt;
&lt;p&gt;Now that we have our newly built k6 binary, we can run scripts using the functionalities
of the bundled extensions.&lt;/p&gt;



  

  






  

  



  &lt;div class=&#34;code&#34; x-data=&#34;app_code([&amp;#34;bash&amp;#34;,&amp;#34;batch&amp;#34;], false)&#34; x-init=&#34;init()&#34; data-codetoggle=&#34;true&#34;&gt;
    &lt;div class=&#34;toggle-toolbar &#34;&gt;
      &lt;div&gt;&lt;button class=&#34;toggle-toolbar__item&#34; :class=&#34;{ &#39;toggle-toolbar__item-active&#39;: active === &#39;bash&#39; }&#34; @click=&#34;$store.code.language = &#39;bash&#39;&#34;&gt;
              &lt;span&gt;Bash&lt;/span&gt;
            &lt;/button&gt;&lt;button class=&#34;toggle-toolbar__item&#34; :class=&#34;{ &#39;toggle-toolbar__item-active&#39;: active === &#39;batch&#39; }&#34; @click=&#34;$store.code.language = &#39;batch&#39;&#34;&gt;
              &lt;span&gt;batch&lt;/span&gt;
            &lt;/button&gt;&lt;/div&gt;
      &lt;div class=&#34;d-flex&#34;&gt;&lt;span class=&#34;code-clipboard&#34; x-ref=&#34;tooltip&#34;&gt;
          &lt;button @click=&#34;copy()&#34;&gt;
            &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
            &lt;span&gt;Copy&lt;/span&gt;
          &lt;/button&gt;
        &lt;/span&gt;
      &lt;/div&gt;
      &lt;div class=&#34;toggle-toolbar__border&#34;&gt;&lt;/div&gt;
    &lt;/div&gt;
    
    &lt;div class=&#34;code-rendered&#34; &gt;
      
&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;./k6 run my-script.js&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;batch&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-batch&#34;&gt;k6.exe run my-script.js&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;

    &lt;/div&gt;
  &lt;/div&gt;


&lt;blockquote&gt;
&lt;p&gt;Be sure to specify the binary just built in the current directory as &lt;code&gt;./k6&lt;/code&gt;, or else
Linux/Mac could execute another k6 binary on your system path. Windows shells will
first search for the binary in the current directory by default.&lt;/p&gt;&lt;/blockquote&gt;
&lt;h2 id=&#34;encountering-issues&#34;&gt;Encountering issues?&lt;/h2&gt;
&lt;p&gt;If you&amp;rsquo;re having issues, search the &lt;a href=&#34;https://community.grafana.com/c/grafana-k6/extensions/82&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;k6 Community Forum&lt;/a&gt;.
Someone may have had the same issue in the past.&lt;/p&gt;
]]></content><description>&lt;h1 id="build-a-k6-binary-using-docker">Build a k6 binary using Docker&lt;/h1>
&lt;p>Using the &lt;a href="https://hub.docker.com/r/grafana/xk6/" target="_blank" rel="noopener noreferrer">xk6 Docker image&lt;/a> can simplify the process of creating a custom k6 binary. It avoids having to setup a local Go environment, and install xk6 manually.&lt;/p></description></item></channel></rss>