Docker
This page provides installation and configuration information for Docker.
Docker
Confirming Docker is installed correctly
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:
Example Output:
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, use the provided container image. The docker image is available on Docker Hub.
The prebuilt version supports both free & paid features of PowerShell Universal.
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, switch to another port.
e.g. Present on port 80
Mount a volume
The docker run
command allows you to mount a volume for persistent storage. Mount the volume 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 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 runs a Powershell Universal container in Windows:
Creating a Compose Script for Mac / Linux
The following compose file runs a Powershell Universal container on Mac and Linux:
Starting Containers using Compose Scripts
Using a Terminal shell or PowerShell for Windows. Use the cd command to change the working 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 Persistence
You can add Environment variables into your Compose Scripts. Below is an example of:
Setting a node name
Adding SQL persistence
Adding a SQL Connection String
Using Environment Variables and PostgreSQL Persistence
You can add Environment variables into your Compose Scripts. Below is an example of:
Setting a node name
Adding PostgreSQL persistence
Adding a PostgreSQL Connection String
Building a Custom Container
If you wish to build more features, modify, or hardcode Environment Variables into your container, then 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, 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 that hosts your Dockerfile, run the following command:
Windows
Run a build with the build command:
Start the docker container with the run command and make sure to specify the volume to mount:
SQL
To use SQL persistence, define the plugin and connection string as follows:
PostgreSQL
To use PostgreSQL persistence, define the plugin and connection string as follows:
Time Zones
To properly support time zones on Linux when scheduling jobs, 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
5.x-preview-modules - Nightly build of version 5 using Ubuntu LTS and select AZ modules
5.x-preview-<OS>-<PS> - Nightly build of version 5 with the specified OS and PS version
4.x-preview-<OS>-<PS> - Nightly build of version 4 with the specified OS and PS version
5.x-<OS>-<PS> - Production version 5 with the specified OS and PS version
5.x-modules - Current production version on Ubuntu LTS with select AZ modules installed
4.x-<OS>-<PS> - Current production version 4 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 basic "How to Get Started" enables you to start running or building PSU Containers. This references section links all sources for commands:
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