Docker

This page provides installation and configuration information for Docker.

Docker

Confirming Docker is installed correctly

NOTE: Note: Apple M1 devices: At the time of writing there are some issues on Apple M1 devices and, some ARM64/ARMv8 devices. Please review this forum thread before proceeding.

Docker

Run the following command to confirm Docker is installed:

docker version

Example Output:

Client: Docker Engine - Community
 Version:           23.0.1
 API version:       1.42
 Go version:        go1.19.5
 Git commit:        a5ee5b1
 Built:             Thu Feb  9 19:47:01 2023
 OS/Arch:           linux/amd64
 Context:           default

Server: Docker Engine - Community
 Engine:
  Version:          23.0.1
  API version:      1.42 (minimum version 1.12)
  Go version:       go1.19.5
  Git commit:       bc3805a
  Built:            Thu Feb  9 19:47:01 2023
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.6.18
  GitCommit:        2456e983eb9e37e47538f59ea18f2043c9a73640
 runc:
  Version:          1.1.4
  GitCommit:        v1.1.4-0-g5fd4c4d
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

Docker Compose

Docker Compose v1 uses the command docker-compose. As of June 2023, support ends for Docker Compose v1.

Docker Compose v2 uses the command docker compose.

If you are using Docker Compose v1 please adjust the commands accordingly. More information on Docker Compose can be found here.

Run one of the following commands to confirm that Docker Compose is installed:

Docker Compose v1:

Docker Compose v2:

Example Output:

A Docker Hello-World

To ensure that Docker has the ability to pull and run container images run the following command:

Example Output:

Installation

Using the pre-built Container

In order to run PowerShell Universal, you can use the provided container image. The docker image is available on Docker Hub.

The prebuilt version supports both free & paid features of PowerShell Universal.

You can start the container by pulling the image and then running a container with the default port bound.

Running a basic image

Present an image to a different port

If port 5000 is unavailable on your host, this can be switched to another port.

e.g. Present on port 80

Mount a volume

The docker run command will allow you to mount a volume for persistent storage. This needs to be mounted to the /root folder.

Mount a volume on container in Windows

The following command mounts the folder C:\docker\volumes\PSU to /root on your container

Mount a volume on Container on Mac and Linux

The following command mounts the folder /docker/volumes/PSU to /root on your container

Stopping a Container

The following command removes a stopped container named PSU

Removing a Container

The following command stops a container named PSU

The --force flag can be used to remove a running container

Docker Compose

Docker Compose allows you to use a yaml text file to standardize your build and script the deployment (or build) or multiple containers.

The default name for any compose file is docker-compose.yml it is recommended you use this as your compose filename.

Creating a Compose Script for Windows

The following compose file will run a Powershell Universal container in Windows

Creating a Compose Script for Mac / Linux

The following compose file will run a Powershell Universal container on Mac's and Linux

Starting Containers using Compose Scripts

Using a Terminal shell, or PowerShell for Windows. cd to the directory with your docker-compose.yml script.

Run the following command

Example Output:

Stopping Containers using Compose Scripts

Using a Terminal shell, or PowerShell for Windows. cd to the directory with your docker-compose.yml script.

Run the following command

Example Output:

Using Environment Variables and SQL Persistance

You can add Environment variables into your Compose Scripts. Below is an example of:

  • Setting a node name

  • Adding SQL persistance

  • Adding a SQL Connection String

Building a Custom Container

In some cases, you may wish to build more features, modify, or hardcode Environment Variables into your container.

For that, you will need to Create a Dockerfile

NOTE: Dockerfiles' are case-sensitive and must start with a capital 'D'.

To create a Docker image that can persist the Universal data, you can create a dockerfile like the one below.

This Dockerfile exposes port 5000, creates a /data volume, sets configuration environment variables to store the Universal repository and database in the volume and then sets the Universal.Server as the entry point to the container.

Writing a Dockerfile script for Linux

Building a container

From the path your Dockerfile is hosted in run the following command:

Windows

You can run a build with the build command.

You can start the docker container with the run command and make sure to specify the volume to mount.

SQL

To use SQL persistence, you can define the plugin and connection string as follows.

Time Zones

To properly support time zones on Linux when scheduling jobs, you will need to include the tzdata package in your dockerfile along with an environment variable that specifies the server time zone.

Tags

We publish the following tags to Docker Hub.

  • latest - Current version using Ubuntu LTS

  • 4.x-preview-modules - Nightly build of version 4 using Ubuntu LTS and select AZ modules

  • 4.x-preview-<OS>-<PS> - Nightly build of version 4 with the specified OS and PS version

  • 3.x-preview-<OS>-<PS> - Nightly build of version 3 with the specified OS and PS version

  • 4.x-<OS>-<PS> - Production version 4 with the specified OS and PS version

  • 4.x-modules - Current production version on Ubuntu LTS with select AZ modules installed

  • 3.x-<OS>-<PS> - Current production version 3 with the specified OS and PS versions

Included Modules

The module container images include the following modules.

  • Az.Accounts

  • Az.Compute

  • Az.KeyVault

  • Az.Resources

  • Invoke-SqlCmd2

Summary

This has been a very basic "How to Get Started" which will enable you to get started running or building PSU Containers. All sources for commands have been linked in the references section below.

References

Running Containers

https://docs.docker.com/engine/reference/commandline/run/

https://docs.docker.com/engine/reference/commandline/stop/

https://docs.docker.com/engine/reference/commandline/rm/

https://docs.docker.com/compose/

Building Containers

https://docs.docker.com/engine/reference/commandline/build/

Last updated

Was this helpful?