.dockerignore file not respected on MacOS X (VMware)
sync opened this issue · comments
First of all thank you for this project, I couldn't have mad this this far without out.
It seems that my .dockeringore file does nothing.
If I run the following command:
docker build -t dynamite .
docker run -it -v C:$(pwd):C:/src -p 8181:8181 dynamite
and I have a local node_modules
folder I'll always end up with that folder inside my container.
Is there something special I should be doing instead ?
Directory: C:\src
Mode LastWriteTime Length Name
---- ------------- ------ ----
d----- 6/6/2021 4:35 PM node_modules
I did setup my windows docker machine with VMware.
Dockerfile:
# escape=`
# Use the latest Windows Server Core image with .NET Framework 4.8.
FROM mcr.microsoft.com/dotnet/framework/sdk:4.8-windowsservercore-ltsc2019
WORKDIR C:/src
EXPOSE 8181
# Restore the default Windows shell for correct batch processing.
SHELL ["cmd", "/S", "/C"]
# Download the Build Tools bootstrapper.
ADD https://aka.ms/vs/16/release/vs_buildtools.exe C:\TEMP\vs_buildtools.exe
# Install Build Tools with the Microsoft.VisualStudio.Workload.AzureBuildTools workload, excluding workloads and components with known issues.
RUN C:\TEMP\vs_buildtools.exe --quiet --wait --norestart --nocache `
--installPath C:\BuildTools `
--add Microsoft.VisualStudio.Workload.AzureBuildTools `
--remove Microsoft.VisualStudio.Component.Windows10SDK.10240 `
--remove Microsoft.VisualStudio.Component.Windows10SDK.10586 `
--remove Microsoft.VisualStudio.Component.Windows10SDK.14393 `
--remove Microsoft.VisualStudio.Component.Windows81SDK `
|| IF "%ERRORLEVEL%"=="3010" EXIT 0
RUN powershell "Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'));`
mkdir PCFCLI;`
Register-PackageSource -ProviderName Nuget -Name Nuget -Location https://www.nuget.org/api/v2 -Confirm:$false -Verbose -Force;`
Install-Package -Name Microsoft.PowerApps.CLI -ProviderName NuGet -Destination ../PCFCLI -Confirm:$false -Verbose -Force;`
choco install nodejs-lts --force --confirm;`
choco install yarn --force --confirm;`
choco install netfx-4.6.2-devpack --force --confirm"
RUN powershell "$path = $env:path + ';' + $(Resolve-Path 'C:\PCFCLI\Microsoft.PowerApps.CLI*\tools' | Select -ExpandProperty Path); `
Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Environment\' -Name Path -Value $path"
# Define the entry point for the docker container.
# This entry point starts the developer command prompt and launches the PowerShell shell.
ENTRYPOINT ["C:\\BuildTools\\Common7\\Tools\\VsDevCmd.bat", "&&", "powershell.exe", "-NoLogo", "-ExecutionPolicy", "Bypass"]
.dockerignore:
.git
dist
node_modules
yarn-error.log
Hi @sync , Thank you 😊
The .dockerignore
is only used at build time to ignore files and folders in the COPY
instruction of a Dockerfile.
Your Dockerfile does not use this.
When you bind mount a folder with -v C:$(pwd):C:/src
into a running container there isn‘t such filter.
wow I had no idea, thanks for the reply and I guess I can close this issue now.