Docker images for working with SharePoint Framework
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
Dockerfile Updated with the 1.6.0 release of SPFx Sep 5, 2018
LICENSE Added license Feb 22, 2018
README.md Updated with the 1.6.0 release of SPFx Sep 5, 2018

README.md

SharePoint Framework Docker images

Docker images for running SharePoint Framework.

Pulls from Docker Hub Stars on Docker Hub

Usage

  • in Docker Settings > Shared Drives verify that the drive where you create your projects is shared
  • Create a folder for your SharePoint Framework project
  • In the command line (on macOS):
cd [your project]
docker run -it --rm --name ${PWD##*/} -v $PWD:/usr/app/spfx -p 5432:5432 -p 4321:4321 -p 35729:35729 waldekm/spfx
  • In PowerShell on Windows:
cd [your project]
docker run -it --rm --name spfx-helloworld -v ${PWD}:/usr/app/spfx -p 5432:5432 -p 4321:4321 -p 35729:35729 waldekm/spfx
  • In other shells on Windows (assumes that your project is at C:\projects\spfx-helloworld)
cd \projects\spfx-helloworld
docker run -it --rm --name spfx-helloworld -v /c/projects/spfx-helloworld:/usr/app/spfx -p 5432:5432 -p 4321:4321 -p 35729:35729 waldekm/spfx

After the container started you can work with it the same way you would work with SharePoint Framework installed on your host. To create a new SharePoint Framework project in the container command line execute:

yo @microsoft/sharepoint

To open the SharePoint workbench navigate in the browser to https://localhost:5432/workbench.

All files scaffolded by the generator will be stored in your project directory on your host from where you can commit them to source control.

To close the container in the container command line run:

exit

Available tags

  • latest: contains the SharePoint Framework Yeoman generator from the 1.6.0 release
  • online: contains the SharePoint Framework Yeoman generator from the 1.6.0 release
  • onprem: contains the SharePoint Framework Yeoman generator from the 1.6.0 release
  • 1.6.0: contains the SharePoint Framework Yeoman generator from the 1.6.0 release
  • 1.5.1: contains the SharePoint Framework Yeoman generator from the 1.5.1 release
  • 1.5.0: contains the SharePoint Framework Yeoman generator from the 1.5.0 release
  • 1.4.1: contains the SharePoint Framework Yeoman generator from the 1.4.1 release
  • 1.4.0: contains the SharePoint Framework Yeoman generator from the 1.4.0 release
  • 1.3.4: contains the SharePoint Framework Yeoman generator from the 1.3.4 release
  • 1.3.2: contains the SharePoint Framework Yeoman generator from the 1.3.2 release
  • 1.3.1: contains the SharePoint Framework Yeoman generator from the 1.3.1 release
  • 1.3.0: contains the SharePoint Framework Yeoman generator from the 1.3.0 release
  • 1.2.0: contains the SharePoint Framework Yeoman generator from the 1.2.0 release
  • 1.1.3: contains the SharePoint Framework Yeoman generator from the 1.1.3 release
  • 1.1.1: contains the SharePoint Framework Yeoman generator from the 1.1.1 release
  • 1.1.0: contains the SharePoint Framework Yeoman generator from the 1.1.0 release
  • 1.0.2: contains the SharePoint Framework Yeoman generator from the 1.0.2 release
  • ga: contains the SharePoint Framework Yeoman generator from the GA release
  • rc0: contains the SharePoint Framework Yeoman generator from the RC0 release
  • drop-6: contains the SharePoint Framework Yeoman generator from the developer preview drop 6
  • drop-5: contains the SharePoint Framework Yeoman generator from the developer preview drop 5
  • drop-4: contains the SharePoint Framework Yeoman generator from the developer preview drop 4

Known issues

Unable to write files to disk

When running yo @microsoft/sharepoint you get an error that the container is unable to write files to the disk. In most cases this is caused by the drive not being shared in Docker. Go to Docker > Settings > Sharing to enable sharing the drive where your project is located.

Can't access workbench and bundles in SharePoint Framework 1.6.0

When using the container with SharePoint Framework v1.6.0, you can't access the local workbench or can't load bundles in the hosted workbench. This is caused by the default mapping of the workbench to localhost, which isn't accessible outside of the container. To fix it, map the workbench to 0.0.0.0, by modifying the ./config/serve.json file in your SharePoint Framework project to:

{
  "$schema": "https://developer.microsoft.com/json-schemas/core-build/serve.schema.json",
  "port": 4321,
  "hostname": "0.0.0.0",
  "https": true,
  "initialPage": "https://localhost:5432/workbench",
  "api": {
    "port": 5432,
    "entryPath": "node_modules/@microsoft/sp-webpart-workbench/lib/api/"
  }
}

Can't access workbench and bundles in SharePoint Framework 1.5.0

When using the container with SharePoint Framework v1.5.0, you can't access the local workbench or can't load bundles in the hosted workbench. This is caused by a change to the gulp-connect package used by the gulp serve task. To fix the issue, after scaffolding the project, in the code editor open the ./node_modules/gulp-connect/index.js file and change line 106 from:

return this.server.listen(this.port, this.host, (function(_this) {

to (remove the this.host argument):

return this.server.listen(this.port, (function(_this) {

Limitations

Windows 10 Anniversary Update and Windows Server 2016 have native support for containers. At this moment Windows supports only containers built on Windows Server Core or Nano Server and you won't be able to run this container natively on Windows. Instead you should use Docker for Windows or Docker Toolbox.