dockercmdcontainersdocker-for-windows

Open and edit file using cmd only in docker container


I'm building a docker image for windows. The dockerfile used for this image is split to build stange and runtime. For the runtime I'm using mcr.microsoft.com/dotnet/core/aspnet:2.2 which is striped to the bone. Inside the container I have a file, appsettings.json which I would like to open to view and also edit, but have no idea how.

Also is there anyway that I can use the CMD to install anything ? and if not what other choices do i have ?


Solution

  • Instead of modifying config inside of container you can map directory from host into container (-v C:\config:C:\config) - so you can edit config directly on host.

    You can install applications in container, but each application usually require own set of options for that. Often it is easier to use chocolatey for that:

    RUN powershell -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))"
    RUN choco feature enable -n=allowGlobalConfirmation
    RUN choco feature disable -n=showDownloadProgress
    RUN choco install <your-app>