Giter Site home page Giter Site logo

powershell-docker's Introduction

Docker

These DockerFiles enable running PowerShell in a container for each Linux distribution we support.

This requires Docker 17.05 or newer. It also expects you to be able to run Docker without sudo. Please follow Docker's official instructions to install docker correctly.

Release

The release containers derive from the official distribution image, such as centos:7, then install dependencies, and finally install the PowerShell package.

These containers live at hub.docker.com/r/microsoft/powershell.

At about 440 megabytes, they are decently minimal, with their size being the sum of the base image (200 megabytes) plus the uncompressed package (120 megabytes), and about 120 megabytes of .NET Core and bootstrapping dependencies.

Community

The docker files in the community folder were contributed by the community and are not yet officially supported.

Examples

To run PowerShell from using a container:

$ docker run -it microsoft/powershell
Unable to find image 'microsoft/powershell:latest' locally
latest: Pulling from microsoft/powershell
cad964aed91d: Already exists
3a80a22fea63: Already exists
50de990d7957: Already exists
61e032b8f2cb: Already exists
9f03ce1741bf: Already exists
adf6ad28fa0e: Pull complete
10db13a8ca02: Pull complete
75bdb54ff5ae: Pull complete
Digest: sha256:92c79c5fcdaf3027626643aef556344b8b4cbdaccf8443f543303319949c7f3a
Status: Downloaded newer image for microsoft/powershell:latest
PowerShell
Copyright (c) Microsoft Corporation. All rights reserved.

PS /> Write-Host "Hello, World!"
Hello, World!

Building the images

To build an image run ./build.ps1 -build -name <ImageFolderName>.

Example

For example to build Ubuntu 16.04/xenial, which is in ./release/ubuntu16.04:

PS /powershell-docker> ./build.ps1 -Build -Name ubuntu14.04
VERBOSE: lauching build with fromTag: trusty-20180531 Tag: 6.0.2-ubuntu-14.04 PSversion: 6.0.2
VERBOSE: lauching build with fromTag: trusty-20180531 Tag: 6.0.2-ubuntu-trusty PSversion: 6.0.2
VERBOSE: lauching build with fromTag: trusty-20180531 Tag: 6.0.2-ubuntu-trusty-20180531 PSversion: 6.0.2
VERBOSE: lauching build with fromTag: trusty-20180531 Tag: 6.1.0-preview.2-ubuntu-14.04 PSversion: 6.1.0~preview.2
VERBOSE: lauching build with fromTag: trusty-20180531 Tag: 6.1.0-preview.2-ubuntu-trusty PSversion: 6.1.0~preview.2
VERBOSE: lauching build with fromTag: trusty-20180531 Tag: 6.1.0-preview.2-ubuntu-trusty-20180531 PSversion: 6.1.0~preview.2
VERBOSE: image name: powershell.local:6.0.2-ubuntu-14.04
VERBOSE: image name: powershell.local:6.0.2-ubuntu-trusty
VERBOSE: image name: powershell.local:6.0.2-ubuntu-trusty-20180531
VERBOSE: image name: powershell.local:6.1.0-preview.2-ubuntu-14.04
VERBOSE: image name: powershell.local:6.1.0-preview.2-ubuntu-trusty
VERBOSE: image name: powershell.local:6.1.0-preview.2-ubuntu-trusty-20180531

Run the docker image you built

PS /powershell-docker> docker run -it --rm powershell.local:6.1.0-preview.2-ubuntu-14.04 pwsh -c '$psversiontable'

Name                           Value
----                           -----
PSVersion                      6.0.2
PSEdition                      Core
GitCommitId                    v6.0.2
OS                             Linux 4.9.87-linuxkit-aufs #1 SMP Wed Mar 14 15:12:16 UTC 2018
Platform                       Unix
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

NanoServer-Insider Release Notes

Please be sure to use a build from the Windows Insider program, either Windows Server Insider or the Windows 10 Insider, as your Container host before trying to pull this image. Otherwise, pulling this image will fail.

Read more about the changes coming to Nano Server in future releases of Windows Server Insider here.

This is pre-release software

Windows Server Insider Preview builds may be substantially modified before they are commercially released. Microsoft makes no warranties, express or implied, with respect to the information provided here. Some product features and functionality may require additional hardware or software. These builds are for testing purposes only. Microsoft is not obligated to provide any support services for this preview software.

For more information see Using Insider Container Images and Build and run an application with or without .NET Core 2.0 or PowerShell Core 6.

Known Issues

PowerShell Get only works with CurrentUser Scope

Due to known issues with the nano-server-insider, you must specify -Scope CurrentUser when using Install-Module. Example:

Install-Module <ModuleName> -Scope CurrentUser

Docker run requires full path

Note: this is fixed in 10.0.16257.1000 of the NanoServer-Insider build. The powershell version of this should be released soon.

Due to an issue with the container not picking up the path, you must specify the path when running a command on the command line. For example, you would expect to be able to run:

PS > docker run -it microsoft/nanoserver-insider-powershell powershell -c '$psversiontable'

but, in nanoserver-insider-powershell you must run:

PS > docker run -it microsoft/nanoserver-insider-powershell 'C:\program files\powershell\powershell' -c '$psversiontable'

Developing and Contributing

Please see the Contribution Guide for general information about how to develop and contribute.

For information specific to PowerShell-Docker see Development.

If you have any problems, please consult the known issues, developer [FAQ][], and GitHub issues. If you do not see your problem captured, please file a new issue and follow the provided template. If you are developing .NET Core C# applications targeting PowerShell Core, please check out our FAQ to learn more about the PowerShell SDK NuGet package.

Also make sure to check out our PowerShell-RFC repository for request-for-comments (RFC) documents to submit and give comments on proposed and future designs.

Legal and Licensing

PowerShell is licensed under the MIT license.

Windows Docker Files and Images

License: By requesting and using the Container OS Image for Windows containers, you acknowledge, understand, and consent to the Supplemental License Terms available on Docker hub:

Telemetry

By default, PowerShell collects the OS description and the version of PowerShell (equivalent to $PSVersionTable.OS and $PSVersionTable.GitCommitId) using Application Insights. To opt-out of sending telemetry, create an environment variable called POWERSHELL_TELEMETRY_OPTOUT set to a value of 1 before starting PowerShell from the installed location. The telemetry we collect fall under the Microsoft Privacy Statement.

Governance

Governance policy for PowerShell project is described here.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.

powershell-docker's People

Contributors

travisez13 avatar adelton avatar anmenaga avatar jameswtruher avatar stevel-msft avatar

Watchers

James Cloos avatar Aleksandar Nikolić avatar

Forkers

markchipman

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.