<p>I am running the Plutus Pioneer code in a nixos/nix based Docker container and it works a treat. I use the <code>nix-shell</code> as recommended in the pioneer program repo and I only needed to set up the IOHK binary caches and install <code>git</code> (using <code>nix</code>) as a prerequisite. I added <code>curl</code> and <code>tmux</code> to make it more user friendly. I use <code>tmux</code> to set up a three pane session containing the Plutus server, the playground GUI and one for interactive cabal. Below is the contents of the Dockerfile I use to buid the image.</p>
<pre><code>FROM nixos/nix

RUN echo &quot;substituters        = https://hydra.iohk.io https://iohk.cachix.org https://cache.nixos.org/&quot; &gt;&gt; /etc/nix/nix.conf &amp;&amp; \
    echo &quot;trusted-public-keys = hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ= iohk.cachix.org-1:DpRUyj7h7V830dp/i6Nti+NEO2/nhblbov/8MW7Rqoo= cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=&quot; &gt;&gt; /etc/nix/nix.conf &amp;&amp; \
    nix-env --install git &amp;&amp; \
    nix-env --install curl &amp;&amp; \
    nix-env --install tmux
</code></pre>
<p>It is important to map the /nix folder to a data volume for better performance and to keep the size of the running container down. This folder can easily contain a few tens of Gb of data.</p>
<p>I keep the Plutus and Pioneer code repos on the host and map a data volume to bring it into the container:</p>
<pre><code>docker run -it -p 8009:8009 -v hkvb_nixos_plutus:/nix -v $(pwd):/plutus hkvb/nixos.plutus:original sh
</code></pre>
<p>This command only exposes the port of the Playground UI. The <code>hkvb/nixos.plutus</code> image was built using the Dockerfile above and is available on Docker Hub.</p>
<p>There is one minor change required in the Plutus code to make the playground accessible from outside the container. This is in the <a href="https://github.com/input-output-hk/plutus/blob/a2ce64860f10cfacb48070a6efc737a131faee6a/plutus-playground-client/webpack.config.js#L17" rel="nofollow noreferrer">webpack.config.js</a> file of the plutus-playground-client. THe DevServer is only bound to the localhost network interface (of the container). Adding the line</p>
<pre><code>host: &quot;0.0.0.0&quot;,
</code></pre>
<p>makes the server available external to the container.</p>
<p>[UPDATE 08/08/2021]<br />
I have found out that it is best to start from a freshly cloned (or new copy) of the Plutus repository when changing commits for build. Changing commit on a Plutus repository that was already used for a build often resulted in problems for me, often leading to never ending builds, especially when building the documentation.</p>

CC BY-SA 4.0
2021-10-12T09:34:06.260Z
I'm trying to get this work on my MacOS host, but when I run the Dockerfile, the resulting container has no nix commands available on it. 

I must be missing something, and will have to do some more research about this, but shouldn't the docker image at nixos/nix have nix already set up on it?
marcel_g
CC BY-SA 4.0
2021-10-14T01:38:19.470Z
I found the issue with this for me: when I build the image, the nix folder is there in the image, but when I run it, mounting the /nix folder as a volume overrides the nix folder from the image, so it has nothing in it. 

I've now made a new Ubuntu based Dockerfile that sets up Nix, which is very similar to how the Nixos/Nix Dockerfile sets it up on Alpine, but I skip mounting the nix folder to a host volume.
marcel_g
CC BY-SA 4.0
2021-08-02T17:01:03.557Z
2021-08-08T20:54:26.437Z
2021-08-08T20:54:26.437Z
vcwebco
<p>There are instructions on the official input-output-hk/plutus-pioneer-program repo in the exercises chapter here: <a href="https://github.com/input-output-hk/plutus-pioneer-program#exercises" rel="nofollow noreferrer">https://github.com/input-output-hk/plutus-pioneer-program#exercises</a></p>
<p>I think you may be missing the following step:</p>
<blockquote>
<p>Set-up IOHK binary caches <a href="https://github.com/input-output-hk/plutus#iohk-binary-cache" rel="nofollow noreferrer">How to set up the IOHK binary caches</a>. &quot;If you do not do this, you will end up building GHC, which takes several hours. If you find yourself building GHC, STOP and fix the cache.&quot;</p>
</blockquote>
<p>As far as I can tell, GHCJS is not necessary, but I haven't tested this.</p>

CC BY-SA 4.0
2021-06-22T01:32:23.440Z
I do have the binary caches set up. The instructions in the input-output-hk/plutus-pioneer-program repo assume quite a lot is set up already. This includes but may not be limited to : nix, ghc, cabal and npm. I have installed all these and the Plutus Client is still not working for me. I was hoping for a one page "How to set up an environment from scratch". A ready made docker container would be even better.
phil-hawkins
CC BY-SA 4.0
2021-06-21T10:26:10.580Z
2021-06-21T10:26:10.580Z
eddex
<p>I'm trying to run the Plutus Pioneer code on a Docker container based on <a href="https://hub.docker.com/r/nixos/nix" rel="noreferrer">https://hub.docker.com/r/nixos/nix</a>.</p>
<p>I've followed this guide to install Cabal and GHC <a href="https://www.reddit.com/r/haskell/comments/dg4dvs/install_ghc_in_25mins_or_ghcjs_in_one_sleep_with/" rel="noreferrer">https://www.reddit.com/r/haskell/comments/dg4dvs/install_ghc_in_25mins_or_ghcjs_in_one_sleep_with/</a></p>
<p>I haven't been able to get GHCJS installed, though I'm not sure if it is necessary.</p>
<p>Is there any guide on pre-requisites for the Plutus Pioneer Program, ideally with install instructions?</p>

CC BY-SA 4.0
2021-06-21T19:22:30.097Z
It might be easier to start with the [plutus-starter](https://hub.docker.com/r/inputoutput/plutus-starter-devcontainer) container, although I can't get it to work right now - I'm not sure if it's broken or that's just me (https://github.com/input-output-hk/plutus/issues/3405)
Danny Tuppeny - CODER
<plutus-pioneer-program><haskell><docker>
Is there documentation on the Prerequisites for Plutus Pioneer code?
# Is there documentation on the Prerequisites for Plutus Pioneer code?

(Asked by: username_0 on 2021-06-21)

I'm trying to run the Plutus Pioneer code on a Docker container based on <https://hub.docker.com/r/nixos/nix>.

I've followed this guide to install Cabal and GHC <https://www.reddit.com/r/haskell/comments/dg4dvs/install_ghc_in_25mins_or_ghcjs_in_one_sleep_with/>

I haven't been able to get GHCJS installed, though I'm not sure if it is necessary.

Is there any guide on pre-requisites for the Plutus Pioneer Program, ideally with install instructions?

**Tags:** plutus-pioneer-program, haskell, docker
> **Comments:**
> **username_1**: It might be easier to start with the [plutus-starter](https://hub.docker.com/r/inputoutput/plutus-starter-devcontainer) container, although I can't get it to work right now - I'm not sure if it's broken or that's just me (https://github.com/input-output-hk/plutus/issues/3405)  

---

## 2 answers

### Answer by username_4 on 2021-06-21. Score: 4

There are instructions on the official input-output-hk/plutus-pioneer-program repo in the exercises chapter here: <https://github.com/input-output-hk/plutus-pioneer-program#exercises>

I think you may be missing the following step:

> Set-up IOHK binary caches [How to set up the IOHK binary caches](https://github.com/input-output-hk/plutus#iohk-binary-cache). "If you do not do this, you will end up building GHC, which takes several hours. If you find yourself building GHC, STOP and fix the cache."

As far as I can tell, GHCJS is not necessary, but I haven't tested this.

> **Comments:**
> **username_0**: I do have the binary caches set up. The instructions in the input-output-hk/plutus-pioneer-program repo assume quite a lot is set up already. This includes but may not be limited to : nix, ghc, cabal and npm. I have installed all these and the Plutus Client is still not working for me. I was hoping for a one page "How to set up an environment from scratch". A ready made docker container would be even better.  

---

### Answer by username_2 on 2021-08-02. Score: 2

I am running the Plutus Pioneer code in a nixos/nix based Docker container and it works a treat. I use the nix-shell as recommended in the pioneer program repo and I only needed to set up the IOHK binary caches and install git (using nix) as a prerequisite. I added curl and tmux to make it more user friendly. I use tmux to set up a three pane session containing the Plutus server, the playground GUI and one for interactive cabal. Below is the contents of the Dockerfile I use to buid the image.
FROM nixos/nix

RUN echo "substituters        = https://hydra.iohk.io https://iohk.cachix.org https://cache.nixos.org/" >> /etc/nix/nix.conf && \
    echo "trusted-public-keys = hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ= iohk.cachix.org-1:DpRUyj7h7V830dp/i6Nti+NEO2/nhblbov/8MW7Rqoo= cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=" >> /etc/nix/nix.conf && \
    nix-env --install git && \
    nix-env --install curl && \
    nix-env --install tmux

It is important to map the /nix folder to a data volume for better performance and to keep the size of the running container down. This folder can easily contain a few tens of Gb of data.
I keep the Plutus and Pioneer code repos on the host and map a data volume to bring it into the container:
docker run -it -p 8009:8009 -v hkvb_nixos_plutus:/nix -v $(pwd):/plutus hkvb/nixos.plutus:original sh

This command only exposes the port of the Playground UI. The hkvb/nixos.plutus image was built using the Dockerfile above and is available on Docker Hub.
There is one minor change required in the Plutus code to make the playground accessible from outside the container. This is in the webpack.config.js file of the plutus-playground-client. THe DevServer is only bound to the localhost network interface (of the container). Adding the line
host: "0.0.0.0",

makes the server available external to the container.
[UPDATE 08/08/2021]
I have found out that it is best to start from a freshly cloned (or new copy) of the Plutus repository when changing commits for build. Changing commit on a Plutus repository that was already used for a build often resulted in problems for me, often leading to never ending builds, especially when building the documentation.

> **Comments:**
> **username_3**: I'm trying to get this work on my MacOS host, but when I run the Dockerfile, the resulting container has no nix commands available on it.   I must be missing something, and will have to do some more research about this, but shouldn't the docker image at nixos/nix have nix already set up on it?  
> **username_3**: I found the issue with this for me: when I build the image, the nix folder is there in the image, but when I run it, mounting the /nix folder as a volume overrides the nix folder from the image, so it has nothing in it.   I've now made a new Ubuntu based Dockerfile that sets up Nix, which is very similar to how the Nixos/Nix Dockerfile sets it up on Alpine, but I skip mounting the nix folder to a host volume.  

---

