💻
Plutus Pioneers Program: Fourth Cohort
  • Welcome to the Plutus Pioneers Program
  • Preliminary Work
    • Learn Haskell
    • Working Environment Set Up
      • Using Demeter
      • Using Docker
  • Lectures
    • Lecture 1
      • Lesson 1.1: Setting Up Our Development Environment
      • Lesson 1.2: Kuber Marketplace Demo
      • Lesson 1.3: Hashing & Digital Signatures
      • Lesson 1.4: The EUTxO-Model
      • Lecture 1 Homework Assignment
    • Lecture 2
      • Lesson 2.1: Low-Level, Untyped Validation Scripts
      • Lesson 2.2: Using the Cardano CLI to Interact with Plutus
      • Lesson 2.3: High-Level, Typed Validation Scripts
      • Lesson 2.4: Lesson 2 Summary
      • Lecture 2 Homework Assignment
    • Lecture 3
      • Lesson 3.1: Script Contexts
      • Lesson 3.2: Handling Time
      • Lesson 3.3: A Vesting Example
      • Lesson 3.4: Parameterized Contracts
      • Lesson 3.5: Off-Chain Code with Lucid
      • Lesson 3.6: Reference Scripts
      • Lesson 3.7: Lesson 3 Summary
      • Lecture 3 Homework Assignment
    • Lecture 4
      • Lesson 4.1: On-Chain Vs. Off-Chain Code
      • Lesson 4.2: Off-Chain Code with Cardano CLI and GUI
      • Lesson 4.3: Off-chain Code with Kuber
      • Lesson 4.4: Off-Chain Code with Lucid
      • Lecture 4 Homework Assignment
    • Lecture 5
      • Lesson 5.1: Introduction to Native Tokens in Cardano
      • Lesson 5.2: The Value Type
      • Lesson 5.3: A Simple Minting Policy
      • Lesson 5.4: A More Realistic Minting Policy
      • Lesson 5.5: Non-Fungible Tokens (NFTs) in Cardano
      • Lecture 5 Homework Assignment
    • Lecture 6
      • Lesson 6.1: The State Monad in Practice
      • Lesson 6.2: Introduction to the Plutus Simple Model Library
      • Lesson 6.3: Unit Testing a Smart Contract
      • Lesson 6.4: Property Testing a Smart Contract
      • Lesson 6.5: Testing Smart Contracts with Lucid
      • Lecture 6 Homework Assignment
    • Lecture 7
      • Lesson 7.1: Introduction to Marlowe
      • Lesson 7.2: Marlowe Playground Demo
      • Lecture 7 Homework Assignment
      • Lesson 7.3: Marlowe Starter Kit - Docker
      • Lesson 7.4: Marlowe Starter Kit Preliminaries
      • Lesson 7.5: ZCB using the Marlowe Runtime command-line client
      • Lesson 7.6: ZCB using the Marlowe Runtime REST API
      • Lesson 7.7: ZCB using the Marlowe Runtime CLI
      • Lesson 7.8: Escrow using the Marlowe Runtime's REST API
      • Lesson 7.9: Swap contract using the Marlowe Runtime's REST API
    • Lecture 8
      • Lesson 8.1: Introduction to Lecture 8
      • Lesson 8.2: The Private Testnet
      • Lesson 8.3: Plutus and Staking
      • Lesson 8.4: Trying Stake Validators on the Private Testnet
      • Lecture 8 Homework Assignment
    • Lecture 9
      • Lesson 9.1: Creating our own Stablecoin Dapp
      • Lesson 9.2: Using our Stablecoin Dapp UI
      • Lesson 9.3: Stablecoin's Oracle
      • Lesson 9.4: Deploying Stablecoin's Reference Scripts
      • Lesson 9.5: Minting Stablecoins
      • Lesson 9.6: Burning Stablecoins and Liquidating Positions
      • Lesson 9.7: Testing our Stablecoin's scripts
      • Lecture 9 Homework Assignment
    • Lecture 10
      • Lesson 10.1: Developing a Dapp with MeshJS and PluTs (Typescript)
      • Lesson 10.2: Developing smart contracts with Plu-Ts (Typescript)
      • Lesson 10.3: Developing smart contracts with OpShin and PyCardano (Python)
      • Lesson 10.4: Developing smart contracts with Plutarch (Haskell)
      • Lesson 10.5: Aiken Hello World (CLI version)
Powered by GitBook
On this page
  • Installing Docker
  • Installing Visual Studio Code
  • Running the PPP Docker Container
  • Forking the PPP Repository
  • Cloning your Fork
  • Opening the PPP Docker Container in Visual Studio Code
  • Troubleshooting Guide
  • General Issues
  • Linux Issues
  • Windows Issues
  1. Preliminary Work
  2. Working Environment Set Up

Using Docker

PreviousUsing DemeterNextLecture 1

Last updated 2 years ago

In this guide, you'll learn how to set up a local working environment using Docker and Visual Studio Code. Whether you have previous experience using Docker or not, we will guide you step by step, from installing the software you need to test your working environment.

If you find issues while following this guide, please review the . If you don't see a solution to your problem, you can ask for help in the .

Use a host computer, not a virtual machine. These setup instructions will only work for a successful installation if you use Docker Desktop on your host computer. The setup inside a virtual machine will fail, whether it's a Windows or Linux virtual machine.

Installing Docker

is a platform designed to help developers build, share, and run applications in an isolated environment on any operating system.

To ease setting up a local working environment for this course, the IOG Education Team created a Docker container that packages all the dependencies required to follow up the lessons of this program.

A Docker container is a standard unit of software that packages up code and all its dependencies, so an application runs quickly and reliably from one computing environment to another. From the Docker documentation, you can learn more about Docker containers on .

Follow the next steps to install Docker in your computer.

  1. Open your browser and navigate to . Click the "Download Docker Desktop" button from the Docker's homepage. By default, you'll download a version compatible with your operating system. Docker is available for Linux, Microsoft Windows, and Apple macOS. The image below shows how the download button looks on a computer using Microsoft Windows. We'll use this operating system for this guide.

Important note for macOS users. Be sure that you download the correct version according to the chip of your computer, for M1 or M2 chips, . For Intel chips, .

  1. After downloading the Docker Desktop installer, execute it and follow the instructions by choosing the default options. Installation options may vary depending on your chip and operating system. If you need detailed instructions, please visit the on the docker docs website.

After installing Docker Desktop, it'll automatically start after login into your computer. You can change this behavior by turning off the "Start Docker Desktop when you log in" in the Docker Settings configuration. The following image shows the general settings in Docker Desktop running on Windows.

To learn more about changing the settings in Docker Desktop, please visit the of the Docker Desktop manual.

Now that you have Docker Desktop up and running let's download and install Visual Studio Code.

Installing Visual Studio Code

Don't install any Haskell extension in Visual Studio Code. If you have VS Code installed, you may see several prompts from VS Code asking for permission to install several Haskell extensions when you open the PPP repository. You don't need to install any of those, as the Docker container we deliver will install all the Haskell extensions that VS Code needs. Some Pioneers who installed additional Haskell extensions report issues in completing this install guide; also, IOG's Education Team members experienced problems while compiling Plutus scripts.

Follow the next steps to install VS Code and a handy extension that you will use in this course.

  1. Once you have installed VS Code, open it to install an extension. Extensions are additional add-ons that extend the VS Code's functionality; Microsoft provides some extensions, but also, plenty of extensions are created by other companies and developers. To install an extension, click on the "Manage" icon in the bottom left corner and choose the "Extensions" options in the image below shows.

  2. After successfully installing the Remote Development extension, you'll note that an "Uninstall" button appears in the extension description tab, and the "Open a Remote Window" icon will appear on the bottom left corner of the VS Code UI as you can see in the following image.

Awesome, you have installed all the required software to use the Docker container! Now, we'll guide you through the steps you must follow to load the Docker container and execute it for the first time.

Running the PPP Docker Container

Before moving forward into using the Docker container provided for this cohort of the PPP, you need to close VS Code. Next, please follow the next section, where we'll guide you on finishing the setup of your local working environment.

Forking the PPP Repository

Follow the next steps to fork the PPP repository.

  1. You are free to navigate through the branches of previous cohorts, but please, be aware of using the correct branch for the 4th. Cohort.

  1. To fork the repository, click the "Fork" icon in the upper right corner, as seen in the image below.

  2. You will see the "Create a new fork" page next. Be sure to select an owner and set a repository name. By default, if you only have one GitHub account, you will see your username in the "Owner" option. You can leave the "Repository name" box as is. If you only want to fork the branch of the 4th. Cohort, be sure to check the box next to the "Copy the fourth-iteration branch only" option. Finally, click on the "Create fork" button to continue. You can see an example of these options in the image below.

  3. Now, the PPP repo will be forked into your GitHub account. You will see a page similar to the one in the image below. The process may take a few seconds.

  4. After a few seconds, you'll see your fork. To corroborate that you're using your fork, note that your user name appears in the repository's name in the upper left corner. For example, in the image below, a fork was created by the user jarturomora.

Now that you forked the repo let's clone it into your computer.

Cloning your Fork

As for now, your fork of the PPP repository will be your development repository. Using your fork, you can work on the homework assignment and share your progress by pushing updates to your fork. In this section, we'll guide you through the process of cloning your fork in your computer.

Please follow the next steps to clone your PPP fork.

  1. Ensure that your PPP fork is open in your browser on the GitHub website. Next, as you can see in the image below, click on the "Code" green button to open the clone options and continue by clicking on the "Copy" icon next to the repository path to copy that path to the clipboard.

  2. git clone git@github.com:jarturomora/plutus-pioneer-program.git
  3. Press enter, and your fork will start to be cloned at your computer, as you can see in the animation below.

    The previous animation shows a terminal window where the user types cd Code to move to a local directory called Code. Next, the user types git clone followed by copying the path of the GitHub fork that the user wants to clone. Once the command is complete, the user hits the enter key, and the fork is cloned.

Now that you cloned your fork into your computer, it's time to open the Docker container using VS Code.

Opening the PPP Docker Container in Visual Studio Code

Before moving forward, please close VS Code if it's open, as it needs to restart to allow the "Remote Development" extension to detect the Docker file in the repo.

Please follow the next steps to open and configure your PPP Docker container.

  1. Open a terminal window, navigate to the directory where you clone your PPP fork, and type code . to open Visual Studio Code inside the repository's directory. The following image shows an example of this command's appearance in a Git BASH terminal.

  2. When VS Code opens, the "Remote Development" extension will detect the Docker container. As shown in the image below, you'll see a message asking to reopen your project in the container. Click on the "Reopen in Container" button to continue.

  3. After reopening your project in Container, the Docker container will be built. As you can see in the image below, you can click on the "Starting Dev Container" message to view the log. Please show the log to be aware of when the container is ready.

    The following image shows how the log looks after you open it.

  4. After a few minutes, you will see a message in the log starting with the text Start: Run in container as you can see in the image below. This message indicates that the dev container is ready. You can safely close this terminal window by clicking on the trash can icon in the upper right corner of the terminal window.

  5. Now, open a new terminal window into VS Code by clicking on the "Terminal" menu, as shown in the image below.

  6. From the new terminal window, type and execute the following command to enter into the code directory of the repository. This step is critical as all the code and updates should run into the code directory.

    cd code

    Next, after switching to the code directory, type and execute the following command to update all the dependencies required by Plutus.

    cabal update

    The following image shows a sample execution of these commands.

    Once the cabal update command execution ends, you will see the terminal prompt waiting to move forward, as seen in the image below.

Be patient while running these commands. Depending on your hardware configuration and an internet connection, the time required to execute the command cabal update may vary. It takes at least 5 minutes to finish; however, we experienced waiting times of up to 15 minutes in some hardware and internet settings.

  1. Now, to finish the dev container setup, type and execute the following command in the VS Code terminal to build all the dependencies required by Plutus.

    cabal build all

    A sample execution of this command is shown in the image below.

    After successfully running this command, you will see the system prompt back with no errors, as shown in the image below.

Congratulations! You have installed your local working environment.

Be patient while running this command. The time required to execute this command may vary depending on your hardware configuration and internet connection. It can take at least 10 minutes to finish. However, we experienced waiting times of up to 25 in some hardware and internet settings.

Troubleshooting Guide

We hope you set up your local working environment smoothly! However, we know problems may happen, so please follow this guide in case you find any issues during the installation process.

General Issues

The following issues may occur on any operating system.

  • Some Pioneers reported that they are getting this message from the Docker terminal in VS Code.

    The connection to the terminal's pty host process is unresponsive, the terminals may stop working.

Linux Issues

Windows Issues


, also known as VS Code, is a source code editor freely distributed by Microsoft that runs on Windows, Linux, and macOS. Additionally, to allow code editing, VS Code allows developers to create and install extensions that ease their daily work.

Open your browser and navigate to to open the Visual Studio Code website. As the image below shows, there is a button where you can download this software. Depending on your operating system, the button's name will change. Be sure to download the latest version. The button to download VS Code for Windows is highlighted for this demo.

To download VS Code for any operating system, please visit the and choose the operating system of your preference.

After downloading the VS Code installer, execute it and follow the instructions by choosing the default options. Installation options may vary depending on your chip and operating system. If you need detailed instructions, please visit the in the VS Code docs website.

Next, a window showing the "Extensions Marketplace" will appear on the left side of the VS Code UI. In the search box, type remote development to look for the . Once the extension appears, click on it. As the image below shows, you should click on the "Install" button to install an extension.

In this section, we'll guide you to fork the repository for the Plutus Pioneers Program in GitHub. A fork is a new repository that shares code and visibility settings with the original repository. It's like having a personal copy of the original repo hosted in your GitHub account. You can learn more about forks in the at GitHub Docs.

Note that you need a GitHub account to fork the repository. If you don't have a GitHub account, please follow to create one. If you need further assistance in creating a GitHub account, please read the at GitHub Docs.

Open your browser, navigate to , and login into your GitHub account.

After login into GitHub, open the PPP repository by opening this URL: . As this guide works for the 4th. Cohort of the PPP, ensure the branch fourth-iteration is selected, as you can see in the image below.

A branch is an isolated version of the main repository. Usually, branches are used to work on particular projects within a git repository. You can learn more about managing branches in GitHub in the at GitHub Docs.

To clone your fork into your computer, you need to have Git installed. If you don't have Git installed, please follow , where you'll find detailed information about installing Git on Linux, macOS, and Windows.

Open a terminal window (we recommend using in Windows) and navigate to a directory where you want to save the PPP fork clone. Next, type git clone and paste the path you copied from your fork at GitHub to build the following command.

The solution to this issue, is to uninstall VS Code and install the Insiders version. You can download this version .

If while opening the Docker container in VS Code, you get an error message that says View container 'remote' requires 'enabledApiProposals: ["contribViewsRemote"]' to be added to 'Remote'. You may uninstall VS Code and install the Insiders version. You can download this version . To learn more about why this issue may happen, please read the from the Visual Studio Code documentation.

If you have installed Docker Desktop before joining the PPP, you may receive an error message asking to install the latest WSL version. An example of the error message is shown in the image below. Please refer to for further instructions.

This work is licensed under a .

Visual Studio Code
https://code.visualstudio.com/
Download Visual Studio Code page
Setting up Visual Studio Code section
Remote Development extension provided by Microsoft
Fork a repo section
this link
Signing up for GitHub section
https://github.com/
https://github.com/input-output-hk/plutus-pioneer-program
About branches page
these instructions from the Git documentation
Git BASH
from this page
from this page
Using Proposed API article
this page from the Windows Subsystem for Linux Documentation
Creative Commons Attribution 4.0 International License
#pioneers-questions channel in Discord
Docker
this page
https://www.docker.com/
download the "Apple Chip" version
download the "Intel Chip" version
Get Docker section
"Change Settings" section
Troubleshooting Guide section
Creative Commons License BY 4.0
Visual Studio homepage where the button to download this software for Windows is highlighted.
Visual Studio UI where the Extensions option is highlighted in the Manage menu.
Visual Studio Extensions Marketplace where the Remote Development extension is highlighted.
Visual Studio UI after a successful installation of the Remote Development extension.
Fourth-iteration branch of the PPP repository in GitHub.
The PPP repository in GitHub where the fork icon is highlighted.
Sample setting to fork the PPP repository.
Waiting page that appears while forking a repository in GitHub.
Sample fork of the PPP repository in GitHub.
Sample fork of the PPP repository in GitHub where the Code button and the clone options are highlighted.
A terminal window where the PPP fork is cloned into a local directory in a computer.
A terminal window whe VS Code is opened from a repository's directory.
VS Code UI where a message to reopen the project in Container is highlighted.
VS Code UI where Starting Dev Container message is highlighted.
VS Code UI where the dev container log is shown.
VS Code UI showing a message that indicates that the dev container is ready.
VS Code UI showing how to open a new terminal window.
VS Code terminal window shows how to switch to the code directory to update cabal.
VS Code terminal window shows the terminal prompt after updating cabal.
VS Code terminal window shows the cabal build all command.
VS Code terminal window shows the system prompt after executing the cabal build all command.
A sample error message from Docker Desktop in Windows asking to update the WSL kernel.
Docker homepage where the Download Docker Desktop button is highlighted.
Docker Desktop general settings in a Windows computer.