I'm building a Docker image based from microsoft/powershell:ubuntu16.04
. It builds properly without any error, however when I go to use it it doesn't have the imported module that I stated in the Dockerfile (which is a psd1 file from a GitHub repo cloned in the image.
I tried with a simple import of Microsoft's powershell management as well (seen below), and it also doesn't get imported. I ran the image interactively and the commands one by one and everything imported fine, so I don't know why it doesn't work through the Dockerfile build itself.
FROM microsoft/powershell:ubuntu16.04
WORKDIR /workdir
RUN pwsh -command "Import-Module Microsoft.PowerShell.Management"
CMD [ "pwsh", "-Command", "Get-Module" ]
Example psd1 file
FROM microsoft/powershell:ubuntu16.04
RUN apt-get update && apt-get install git -y
RUN git clone https://github.com/DTW-DanWard/PowerShell-Beautifier.git
RUN cp -a PowerShell-Beautifier/src/. /opt/microsoft/powershell/6.0.0-rc/Modules
ENTRYPOINT [ "pwsh", "-c" ]
CMD [ "Get-Help", "Edit-DTWBeautifyScript" ]