Skip to content
This repository has been archived by the owner on Jun 17, 2024. It is now read-only.

Setting up a Docker based Development environment

vkanne-msft edited this page Oct 3, 2016 · 11 revisions

This document describes a sample development environment setup based on Docker, using the available Dockerfile in the repository.

These instructions can be used on Windows, Mac and Linux based Development boxes. The included Docker image is based on Ubuntu and provides instructions for a Linux based compile. We don't have instructions yet for other Docker images.

Install Docker

Docker is available at https://docker.io. Download and install the Docker version suitable for your platform. See also Running F* from a docker image from the F* Wiki.

For best performance, after setup, open Docker settings and setup for as many cores possible (as supported by your machine). Also setup atleast 4-8GB of memory as default.

Clone Git repository

To begin, clone the Git repo into a local folder on your machine.

$git clone https://github.com/mitls/mitls-fstar.git 

Run Docker image

We will run the Docker image with the host folder mounted by default. This way the host folder can be used for Editing and Development and Docker for compilation. The host folder location might vary and will have a different syntax on Windows, i.e., it will include your volume name as /c/Users....

docker run -t -i -v /Users/vkanne/mitls-dev/mitls-fstar/:/home/mitls-fstar --name mitls fstarlang/fstar /bin/bash

Here

  • /Users/vkanne/mitls-dev/mitls-fstar is my home folder
  • /home/mitls-fstar is the folder where this source code will be mounted
  • mitls is the name of the new docker container. You can use this name to attach to the container anytime.
  • fstarlang/fstar is the name of the image that is stored in Docker repository
  • /bin/bash instructs Docker to start the bash shell

Note: There are variants of Docker images stored in Docker repository. Fstarlang/fstar is the base version. We also have a Fstarlang/fstar-emacs that can help you enable Emacs. Check out Docker instructions at https://github.com/FStarLang/FStar/wiki/Running-F%2A-from-a-docker-image

You should now see a Linux command prompt with root@. Your Docker image is ready and running.

Pitfalls on Windows: Be sure to activate C: as a shared drive in the docker settings and to add it in front of your path as /c/Users....

Run Docker image without mounting Git Repo folder

Some developers might choose to clone the Git repo inside the Docker image. In such a case you can use the simpler command to run the Docker image and open a shell.

docker run -t -i fstarlang/fstar /bin/bash

Compile FStar and miTLS sources

Once in the bash shell from the Docker image you can run the required steps to compile fstar and mitls

Fstar@3077c4233e59:~# cd /home/mitls-fstar/ 
Fstar@3077c4233e59:/home/mitls-fstar# git submodule init  
Submodule '.fstar' (https://github.com/FStarLang/FStar.git) registered for path '.fstar'  
Fstar@3077c4233e59:/home/mitls-fstar# git submodule update  
Fstar@3077c4233e59:/home/mitls-fstar#  make -C .fstar/src/ocaml-output   
Fstar@3077c4233e59:/home/mitls-fstar#  make -C src/tls all-ver -k -j 2   

The Docker images should save you a good amount of time to setup and compile this project. Look out for updates in the future to support more development environments.